Macro Help - ASAP - Please!

T

Theo

I have this macro which works great.
But I need to ALSO copy/paste the format of the cells

Sub Macro1()
Sheets("Sheet1").Rows("1:1").Copy
Sheets("Sheet2").Rows("3:5").PasteSpecial
Paste:=xlPasteValidation, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub
 
P

Per Jessen

Theo said:
I have this macro which works great.
But I need to ALSO copy/paste the format of the cells

Sub Macro1()
Sheets("Sheet1").Rows("1:1").Copy
Sheets("Sheet2").Rows("3:5").PasteSpecial
Paste:=xlPasteValidation, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub

Hi Theo

Substitute "Paste:=xlPasteValidation" with "Paste:=xlPasteAll"

//Per
 
M

Mike H

Theo,

This should do it

Sub Macro1()
Sheets("Sheet1").Rows("1:1").Copy
Sheets("Sheet2").Rows("3:5").PasteSpecial
End Sub

Mike
 
D

Dave Peterson

Paste it twice

Sheets("Sheet1").Rows("1:1").Copy

Sheets("Sheet2").Rows("3:5").PasteSpecial Paste:=xlPasteValidation, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Sheets("Sheet2").Rows("3:5").PasteSpecial Paste:=xlPasteFormats
 
J

JLGWhiz

VBA PasteSpecial does not support what you want to do in a single action.
You will have to to accomplish it in a secondary action.
 
G

Gary Keramidas

just add another line of code:

Sub Macro1()
Sheets("Sheet1").Rows("1:1").Copy

With Sheets("Sheet2").Rows("3:5")
.PasteSpecial Paste:=xlPasteValidation, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With

End Sub
 
T

Theo

Cool - I had tried repeating it, but I did not have the End With statement -
I'll try that!
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top