M
ManhattanRebel
I am using this macro, taken from "Mr. Excel" Bill Jelen's book, which was
written in 2004. I have Excel 2007, and I don't know if something has
changed. I use Watch feature when debugging this. The expression "i" seems
to work, but nothing shows up in expression "Value". The debugger reads,
"<Expression not defined in context>. Any suggestions are appreciated.
Sub CopyPasteSurcharges()
'
'Macro to copy Surcharges from existing fields and move to new fields
'
Sheets("Ground").Activate
FinalRow = Cells(65536, 55).End(xlUp).Row
For i = 2 To FinalRow
Select Case Cells(i, 55).Value
Case "Additional Handling"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 79)
Case "Additional Weight"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 81)
Case "Address Correction"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 83)
Case "Adult Signature"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 85)
Case "Call Tag"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 87)
Case "COD"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 89)
Case "Courier Pick-Up Charge"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 91)
Case "Declared Value"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 93)
End Select
Next i
End Sub
written in 2004. I have Excel 2007, and I don't know if something has
changed. I use Watch feature when debugging this. The expression "i" seems
to work, but nothing shows up in expression "Value". The debugger reads,
"<Expression not defined in context>. Any suggestions are appreciated.
Sub CopyPasteSurcharges()
'
'Macro to copy Surcharges from existing fields and move to new fields
'
Sheets("Ground").Activate
FinalRow = Cells(65536, 55).End(xlUp).Row
For i = 2 To FinalRow
Select Case Cells(i, 55).Value
Case "Additional Handling"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 79)
Case "Additional Weight"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 81)
Case "Address Correction"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 83)
Case "Adult Signature"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 85)
Case "Call Tag"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 87)
Case "COD"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 89)
Case "Courier Pick-Up Charge"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 91)
Case "Declared Value"
Range(Cells(i, 55), Cells(i, 56)).Copy
Destination:=Cells(i, 93)
End Select
Next i
End Sub