Good Afternoon,
I am trying to get my code to loop through a column and stop when the active cells value is blank. For instance I am trying to print a list of strings next to dates that I use in another loop. The list of strings is in column "H" starting at H2. However when I try and offset my UniqueVal variable I get an error. Any ideas?
I am trying to get my code to loop through a column and stop when the active cells value is blank. For instance I am trying to print a list of strings next to dates that I use in another loop. The list of strings is in column "H" starting at H2. However when I try and offset my UniqueVal variable I get an error. Any ideas?
Code:
Sub GenDates_Values()
Dim FirstDate As Date
Dim LastDate As Date
Dim NextDate As Date
Dim UniqueVal As String
UniqueVal = Range("H2")
Do Until UniqueVal.Value=""
NextDate = FirstDate
FirstDate = Range("startdate").Value
LastDate = Range("enddate").Value
'Cell to begin entering dates
Range("B3").Select
'selection of columns within one row
Do Until NextDate > LastDate
ActiveCell.Value = NextDate
'Move one column over
ActiveCell.Offset(0, -1).Select
'Set name as the unique character
ActiveCell.Value = UniqueVal
'Return to date cell
ActiveCell.Offset(0, 1).Select
'Move one row down
ActiveCell.Offset(1, 0).Select
NextDate = NextDate + 1
Loop
UniqueVal = UniqueVal.Offset(1, 0).Select
Loop
End Sub