Hello,
I'm trying to create a For Each loop, where any cell that is not zero, will be changed to the date that is in row 1 of the same column.
So far I've come up with the following, but I can't seem to find the correct syntax for this seemingly simple problem:
So for instance if C5 = 5, it should change to the value of C1, which is a (shipping) date.
I tried to format something with Cell.Column() or create a Dim as Integer to store the Cell column, but so far without succes.
I've attached a small example of the sheet I use it on (top) and the output I'd want (bottom).
Any suggestion or source would be appreciated.
Thank you!
I'm trying to create a For Each loop, where any cell that is not zero, will be changed to the date that is in row 1 of the same column.
So far I've come up with the following, but I can't seem to find the correct syntax for this seemingly simple problem:
VBA Code:
Sub ArrangeDates()
Dim Cell As Range
Dim ShipDate As Integer
For Each Cell In Range("B2:H50")
If Cell.Value > 0 Then
Cell.Value = //same column, row 1//
End If
Next Cell
End Sub
So for instance if C5 = 5, it should change to the value of C1, which is a (shipping) date.
I tried to format something with Cell.Column() or create a Dim as Integer to store the Cell column, but so far without succes.
I've attached a small example of the sheet I use it on (top) and the output I'd want (bottom).
Any suggestion or source would be appreciated.
Thank you!