C
cbrd
I have the following macro assigned to a button ("New Grass Week") in
the "Grass Cutting" sheet. It is suppose to, upon clicking, take data
from the "Customers" sheet and paste it into the proper columns in the
"Grass Cutting" sheet. It doesnt do anything when clicked and I get no
errors. I just think there something missing.
Any ideas?
URL of the .xls sheet
http://www.ashleylandscaping.com/excel-example.xls
Code:
--------------------
Sub NewGrassWeek()
Dim FilterRange As Range, CopyRange As Range
Dim c As Range, r As Range, x As Range
Set wsHistory = Sheets("Grass Cutting")
Set wsDaily = Sheets("Customers")
Set r = wsDaily.Range("I3:I6666")
Set c = wsHistory.Range("A3:A6666")
Set x = wsDaily.Range("A3:A6666")
For Each r In x
If r.Value = "y" Then
Range("A" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!A:A)"
Range("B" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!B:B)"
Range("C" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!C:C)"
Range("D" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!D)"
Range("E" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!E:E)"
Range("F" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!F:F)"
Range("G" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!G:G)"
Range("H" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!H:H)"
Range("L" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!J:J)"
Application.ScreenUpdating = True
End If
Next r
End Sub
the "Grass Cutting" sheet. It is suppose to, upon clicking, take data
from the "Customers" sheet and paste it into the proper columns in the
"Grass Cutting" sheet. It doesnt do anything when clicked and I get no
errors. I just think there something missing.
Any ideas?
URL of the .xls sheet
http://www.ashleylandscaping.com/excel-example.xls
Code:
--------------------
Sub NewGrassWeek()
Dim FilterRange As Range, CopyRange As Range
Dim c As Range, r As Range, x As Range
Set wsHistory = Sheets("Grass Cutting")
Set wsDaily = Sheets("Customers")
Set r = wsDaily.Range("I3:I6666")
Set c = wsHistory.Range("A3:A6666")
Set x = wsDaily.Range("A3:A6666")
For Each r In x
If r.Value = "y" Then
Range("A" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!A:A)"
Range("B" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!B:B)"
Range("C" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!C:C)"
Range("D" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!D)"
Range("E" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!E:E)"
Range("F" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!F:F)"
Range("G" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!G:G)"
Range("H" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!H:H)"
Range("L" & c.Row).Formula = "=LOOKUP(A" & c.Row & ",Customers!A:A,Customers!J:J)"
Application.ScreenUpdating = True
End If
Next r
End Sub