shes_ohwsome
New Member
- Joined
- Apr 24, 2017
- Messages
- 13
Hello Everyone,
Here's the code for my excel macros, what i want to happen is to copy the values from column AG to another sheet (c1), but every time I run my code it returns #REF because it copies the formula and not the cell value. I need help regarding this TIA
-----------------------------------
Sub price()
With Sheets("PRICE & ATTRIBUTE CHANGE FORM")
LastRowAG = .Range("AG" & .Rows.Count).End(xlDown).Row
LastRowB = .Range("B" & .Rows.Count).End(xlDown).Row
End With
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("B25:B" & LastRowB).Copy Destination:=Sheets("Sheet2").Range("A2")
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("B25:B" & LastRowB).Copy Destination:=Sheets("Sheet2").Range("B2")
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("AG25:AG" & LastRowAG).Copy
Sheets("Sheet2").Range("C2").PasteSpecial Paste:=xlPasteValues
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("B25:B" & LastRowB).Copy
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("AG25:AG" & LastRowAG).Copy
Sheets("Sheet2").Activate
With Sheets("Sheet2")
LastRowA = .Range("A" & .Rows.Count).End(xlUp).Row
End With
Range("A2").Select
Range("B2").Select
Range("C2").Select
Worksheets("Sheet2").Range("C2:C" & LastRowA).Offset(, 1) = "1"
Dim MyCell As Range
For Each MyCell In Range("E2:E" & LastRowA)
MyCell.Value = Mid(Range("A" & MyCell.Row), 6, 2)
Next
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1") = "sku"
Range("B1") = "sku_config"
Range("C1") = "price"
Range("D1") = "pet_approved"
End Sub
Here's the code for my excel macros, what i want to happen is to copy the values from column AG to another sheet (c1), but every time I run my code it returns #REF because it copies the formula and not the cell value. I need help regarding this TIA
-----------------------------------
Sub price()
With Sheets("PRICE & ATTRIBUTE CHANGE FORM")
LastRowAG = .Range("AG" & .Rows.Count).End(xlDown).Row
LastRowB = .Range("B" & .Rows.Count).End(xlDown).Row
End With
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("B25:B" & LastRowB).Copy Destination:=Sheets("Sheet2").Range("A2")
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("B25:B" & LastRowB).Copy Destination:=Sheets("Sheet2").Range("B2")
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("AG25:AG" & LastRowAG).Copy
Sheets("Sheet2").Range("C2").PasteSpecial Paste:=xlPasteValues
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("B25:B" & LastRowB).Copy
Sheets("PRICE & ATTRIBUTE CHANGE FORM").Range("AG25:AG" & LastRowAG).Copy
Sheets("Sheet2").Activate
With Sheets("Sheet2")
LastRowA = .Range("A" & .Rows.Count).End(xlUp).Row
End With
Range("A2").Select
Range("B2").Select
Range("C2").Select
Worksheets("Sheet2").Range("C2:C" & LastRowA).Offset(, 1) = "1"
Dim MyCell As Range
For Each MyCell In Range("E2:E" & LastRowA)
MyCell.Value = Mid(Range("A" & MyCell.Row), 6, 2)
Next
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1") = "sku"
Range("B1") = "sku_config"
Range("C1") = "price"
Range("D1") = "pet_approved"
End Sub