SublimizeD
New Member
- Joined
- Jul 27, 2018
- Messages
- 4
Hello guys!
I have a current project where i am trying to get a macro to set E to A depending on whether or not the value in the previous row is a date. If it is i want it to simply copy down. But if the value before isnt a date i want it to change to copy and pasting the text value . Right now its not switching between variables. Any help would be apprectiated!
I have a current project where i am trying to get a macro to set E to A depending on whether or not the value in the previous row is a date. If it is i want it to simply copy down. But if the value before isnt a date i want it to change to copy and pasting the text value . Right now its not switching between variables. Any help would be apprectiated!
Code:
Sub TravelerUpdate()
'This macro takes the Raw Data From Source and translates it into data we can input into the live data
Sub Test()
Dim i As Long
Dim ii As Long
Dim Name As Long
Dim Datefind As Long
Dim NameColumn As Range
Dim ColumnA As Range
Dim CopyName As Long
ii = 3
i = 3
Set ColumnA = Range("A" & ii)
Set NameColumn = Range("E" & ii)
Name = Range("A:A").Find(", ", searchdirection:=xlPrevious).Row
ii = 3
Datefind = Range("A:A").Find("/", searchdirection:=xlPrevious).Row
For ii = 3 To Name
If ColumnA.Value <> "" Then
If IsDate(ColumnA.Offset(-1).Value) = False Then
'First activity
NameColumn = ColumnA.Offset(-1).Value
ii = ii + 1
End If
End If
'Second
For i = ii To Name
ColumnA = Range("A" & ii)
If ColumnA.Value <> "" Then
Range("E" & ii).Value = ColumnA.Value
If IsDate(ColumnA.Value) Then
NameColumn.Value = Range("E" & ii - 1).Value
Range("E" & ii).Value = NameColumn.Value
ii = ii + 1
End If
End If
'End If
Next i
Next ii
End Sub