Hi guys
I have some vba that is button activated that looks in columns M and N and if there is a "Y" entered in a cell it copies the data in columns A,B,C etc to a spreadsheet with the same name as the column, then removes the "Y" and it all works fine.
But I'm stumbling, The below code inserts a date on the next available line when I need to put a date in column I in the active row as the corresponding "Y" before the vba deletes the "Y"?? (ie: if the "Y" is in cell "M5" it inserts the date in cell "I5" and not the next available row.
I hope the above makes sense?
Thanks guys
I have some vba that is button activated that looks in columns M and N and if there is a "Y" entered in a cell it copies the data in columns A,B,C etc to a spreadsheet with the same name as the column, then removes the "Y" and it all works fine.
But I'm stumbling, The below code inserts a date on the next available line when I need to put a date in column I in the active row as the corresponding "Y" before the vba deletes the "Y"?? (ie: if the "Y" is in cell "M5" it inserts the date in cell "I5" and not the next available row.
I hope the above makes sense?
Thanks guys
VBA Code:
Application.ScreenUpdating = False
Dim lCol As Long, sAddr As String, fnd As Range, x As Long, ws As Worksheet
lCol = ActiveSheet.Cells(4, Columns.Count).End(xlToLeft).Column
x = ActiveCell.Row
Set fnd = Rows(x).Find("y", LookIn:=xlValues, lookat:=xlWhole)
If Not fnd Is Nothing Then
sAddr = fnd.Address
Do
Set ws = Sheets(Cells(4, fnd.Column).Value)
[B]Sheets("CustomerService").Range("I" & Rows.Count).End(xlUp).Offset(1).Value = Now[/B]
With ws
Range("A" & x & ":G" & x).Copy .Cells(.Rows.Count, "A").End(xlUp).Offset(1)
End With
Set fnd = Rows(x).FindNext(fnd)
Loop While fnd.Address <> sAddr
sAddr = ""
End If
Application.ScreenUpdating = True
Range("K5:U999").Select
Selection.ClearContents
Range("B2").Select