Copy cell value

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
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Copy / PasteSpecial / Values

The code can be obtained via the macro recorder.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top