B
BoRed79
Hi.
I have a piece of code which asks the user to enter details of the data that
is being imported and which then enters this date in the column Y of the
spreadsheet - next to those new data entries (see below):
dt = Application.InputBox("Please enter details (mmm-yyyy) for the data
imported")
lastRow = Worksheets("C-National").Cells(Rows.Count, "B").End(xlUp).Row
For Each c In Worksheets("C-National").Range("B3:B" & lastRow)
If c.Value <> "" And Cells(c.Row, "Y").Value = "" Then
Worksheets("C-National").Cells(c.Row, "Y").Value = dt
End If
Next c
This works fine and enters the dates in a treat. However, when the next
batch of data is imported (the next month) it not only putting in the date
for that new data, but is overwriting the dates for the previous month's
data.
I thought that I had got round this by asking the macro to look in the cells
in Column Y and put in the data only if the cell was blank - but this does
not seem to be having the desired effect.
Could anyone advise how I might modify this code to get round this issue.
Many thanks in advance.
Liz.
I have a piece of code which asks the user to enter details of the data that
is being imported and which then enters this date in the column Y of the
spreadsheet - next to those new data entries (see below):
dt = Application.InputBox("Please enter details (mmm-yyyy) for the data
imported")
lastRow = Worksheets("C-National").Cells(Rows.Count, "B").End(xlUp).Row
For Each c In Worksheets("C-National").Range("B3:B" & lastRow)
If c.Value <> "" And Cells(c.Row, "Y").Value = "" Then
Worksheets("C-National").Cells(c.Row, "Y").Value = dt
End If
Next c
This works fine and enters the dates in a treat. However, when the next
batch of data is imported (the next month) it not only putting in the date
for that new data, but is overwriting the dates for the previous month's
data.
I thought that I had got round this by asking the macro to look in the cells
in Column Y and put in the data only if the cell was blank - but this does
not seem to be having the desired effect.
Could anyone advise how I might modify this code to get round this issue.
Many thanks in advance.
Liz.