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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Copy / PasteSpecial / Values

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

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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