Hallo - I have to knock something together in Excel & wanted a date report every time a certain macro was run. To do this, I need to iterate thru the columns in a sheet until one is free, then fill it with a date (I have sample code below) from a field on another sheet.
Trouble is, it doesn't work. The Range just moves to A2 & stays there. I know there is going to be something astoundingly simple that solves this (like a variable for where you're at on a sheet or something), but I have a very thick skin, so please, anyone - just hit me with how stupid I'm being.
The code I spaghetti-ised whilst trying to do this runs:
Sub Macro6()
Dim rw As Long
Dim place As String
Dim val As String
rw = 2
place = "A" & rw
Range("A2".Select
Application.CutCopyMode = False
'Selection.Copy 'COMMENTED OUT
val = Range("A2".Text
Sheets("Record of Weeks".Select
Range(place).Select
While (IsNull(Selection))
'While (Range(place) = Empty) 'COMMENTED OUT
rw = rw + 1
place = "A" & rw
Range(place).Select
Wend
Range(place).Select
'ActiveSheet.Paste 'COMMENTED OUT
Range(place).Value = val
Sheets("Font End".Select
End Sub
Any & all advice gratefully appreciated.
Cheers, Douglas JL If it don't make you laugh, it ain't true.
Trouble is, it doesn't work. The Range just moves to A2 & stays there. I know there is going to be something astoundingly simple that solves this (like a variable for where you're at on a sheet or something), but I have a very thick skin, so please, anyone - just hit me with how stupid I'm being.
The code I spaghetti-ised whilst trying to do this runs:
Sub Macro6()
Dim rw As Long
Dim place As String
Dim val As String
rw = 2
place = "A" & rw
Range("A2".Select
Application.CutCopyMode = False
'Selection.Copy 'COMMENTED OUT
val = Range("A2".Text
Sheets("Record of Weeks".Select
Range(place).Select
While (IsNull(Selection))
'While (Range(place) = Empty) 'COMMENTED OUT
rw = rw + 1
place = "A" & rw
Range(place).Select
Wend
Range(place).Select
'ActiveSheet.Paste 'COMMENTED OUT
Range(place).Value = val
Sheets("Font End".Select
End Sub
Any & all advice gratefully appreciated.
Cheers, Douglas JL If it don't make you laugh, it ain't true.