E
EmmieLou
Need Help! Have my macro putting first row of column C data in column A, but
need the rest of the column to go in as well. Also need to put the data from
column D into column B ( C and D are a set that is of the same data type as a
nd b respectively)
Here is what I have so far.... fairly new to vba, but learning fast.
Thanks!!!
Sub Find_Blank()
Dim BCell, NBCell
Range("A1").Select
Range("B1").Select
For i = 1 To 65536
If ActiveCell.Value = Empty Then 'First empty cell found; put in col
c's stuff:
BCell = "A" & CStr(i)
Range("A" & CStr(i)).Select
CCell = "B" & CStr(i)
Range("B" & CStr(i)).Select
For Each C In Worksheets("Sheet1").Range("C1:C100").Cells
If C.Value <> "" Then
Range("A" & CStr(i)).Select
Range("A" & CStr(i)).Value = C.Value
Range("B" & CStr(i)).Select
Range("B" & CStr(i)).Value = D.Value
i = i + 1
Else 'Blank cell in col B found; get column stuff:
'**
For Each D In Worksheets("Sheet1").Range("D1100").Cells
If D.Value <> "" Then
Range("A" & CStr(i)).Select
Range("A" & CStr(i)).Value = D.Value
i = i + 1
End If
Next D
Exit Sub
'**
End If
Next C
Exit Sub
Else
Range("A" & CStr(i + 1)).Select
End If
Next i
End Sub
need the rest of the column to go in as well. Also need to put the data from
column D into column B ( C and D are a set that is of the same data type as a
nd b respectively)
Here is what I have so far.... fairly new to vba, but learning fast.
Thanks!!!
Sub Find_Blank()
Dim BCell, NBCell
Range("A1").Select
Range("B1").Select
For i = 1 To 65536
If ActiveCell.Value = Empty Then 'First empty cell found; put in col
c's stuff:
BCell = "A" & CStr(i)
Range("A" & CStr(i)).Select
CCell = "B" & CStr(i)
Range("B" & CStr(i)).Select
For Each C In Worksheets("Sheet1").Range("C1:C100").Cells
If C.Value <> "" Then
Range("A" & CStr(i)).Select
Range("A" & CStr(i)).Value = C.Value
Range("B" & CStr(i)).Select
Range("B" & CStr(i)).Value = D.Value
i = i + 1
Else 'Blank cell in col B found; get column stuff:
'**
For Each D In Worksheets("Sheet1").Range("D1100").Cells
If D.Value <> "" Then
Range("A" & CStr(i)).Select
Range("A" & CStr(i)).Value = D.Value
i = i + 1
End If
Next D
Exit Sub
'**
End If
Next C
Exit Sub
Else
Range("A" & CStr(i + 1)).Select
End If
Next i
End Sub