VBA: copy only cell value (without format) ?

chrisignm

Active Member
Joined
Apr 1, 2014
Messages
273
Hey, I got the following code, but the problem is that it replaces the formatting of the cells:

Code:
Sub CopyIndustry1Weights()
Sheets("Tool").Range("L27").Copy Sheets("Tool").Range("I49, P49, I68, P68, I87, P87, I106, P106, I125, P125")
End Sub

Could somebody tell me how I can only copy+paste the value of cell L27 into the others?

Many thanks!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Code:
Range("I49").Value = Range("L27").Value
Range("P49").Value = Range("L27").Value
Range("I68").Value = Range("L27").Value
Range("P68").Value = Range("L27").Value
Range("I87").Value = Range("L27").Value
Range("P87").Value = Range("L27").Value
Range("I106").Value = Range("L27").Value
Range("P106").Value = Range("L27").Value
Range("I125").Value = Range("L27").Value
Range("P125").Value = Range("L27").Value
 
Upvote 0
chrisignm,

If using Copy then need to Paste Special > Values

Code:
Sub CopyIndustry1Weights()
Sheets("Tool").Range("L27").Copy
Sheets("Tool").Range("I49, P49, I68, P68, I87, P87, I106, P106, I125, P125").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub

Or just ....

Code:
Sub CopyIndustry1Weights()


Sheets("Tool").Range("I49, P49, I68, P68, I87, P87, I106, P106, I125, P125") = Sheets("Tool").Range("L27")


End Sub

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,984
Messages
6,182,136
Members
453,091
Latest member
dcasuga

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