Current Macro not Looping through both variables.

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! :):):):)
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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,215,219
Messages
6,123,680
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top