Ask for VBA in excel

I have a question.
If column C empty replace with cell B.

How to write VBA?
I choose VBA because data have 10,000 rows , If run by for each row I think If take time too much.

image Input
image Output

Hi @fairymemay

Please try this

Sub Macro()

For intCount = 2 To Cells(Rows.Count, 1).End(xlUp).Row
    If Cells(intCount, 3).Value = "" Then Cells(intCount, 3).Value = Cells(intCount, 2).Value
Next intCount

End Sub

Thanks

1 Like

@fairymemay,

You can use If formula for this more faster than vba.
plz find attached xaml file and let us know if you’re stuck.

ExcelManipulation.xaml (10.1 KB)

@Pankaj.Patil I run your xaml.
After run your xaml column Type not fulfill and data row2 appear as below.

image
File input : data.xlsx (8.2 KB)

@fairymemay

Have you tried my code…

Thanks

1 Like

@prasath_S It run correctly,

@fairymemay,

I again ran it and worked well at me, debug the code(not a big file) and find where code is going wrong.
otherwise use @prasath_S’ code as it’s working for you.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.