Hello everyone...
I have to insert data into Column C of a spreadsheet based on whether Column A or B are empty or not.
Attached excel file "test1.xls" shows the output format as well as what i have so far in terms of macro and here is the code which I have so far..
Sub Macro2()
Dim X As Integer
Dim numb As Integer
X = 2
numb = 1
Dim strFile As String
Do
If Not IsEmpty("B" & X) Then
If Not IsEmpty("A" & X) Then
strFile = Trim(ActiveSheet.Range("A" & X).Value) + ".pdf"
ActiveCell.Value = strFile
numb = numb + 1
If numb > 4 Then
Exit Sub
End If
X = X + 1
End If
X = X + 1
ActiveCell.Offset(1, 0).Select
ActiveSheet.Range("C" & X).Select
End If
Loop
End Sub
basically, as you would notice that the first 2 entries in Column C match the desired output because the number of entries in Column B is only one. The moment there are more entries than one in Column B, I am unable to skip the rows eg. skipping rows from C6 to C10 in this case.
Any help in this regard is greatly appreciated...
Thanks all in advance :-)
Bookmarks