ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Help - ASAP - Please! (https://www.excelbanter.com/excel-programming/404395-macro-help-asap-please.html)

theo

Macro Help - ASAP - Please!
 
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


Per Jessen

Macro Help - ASAP - Please!
 

"Theo" skrev i en meddelelse
...
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



Mike H

Macro Help - ASAP - Please!
 
Theo,

This should do it

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

Mike

"Theo" wrote:

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


theo

Macro Help - ASAP - Please!
 
I don't want it to paste all - just the validation and the format.

"Theo" wrote:

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


theo

Macro Help - ASAP - Please!
 
But I only want to paste the validation and the format?

"Mike H" wrote:

Theo,

This should do it

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

Mike

"Theo" wrote:

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


theo

Macro Help - ASAP - Please!
 
But I only want to paste the validation and the format?


"Per Jessen" wrote:


"Theo" skrev i en meddelelse
...
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




Dave Peterson

Macro Help - ASAP - Please!
 
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

Theo wrote:

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


--

Dave Peterson

JLGWhiz

Macro Help - ASAP - Please!
 
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.

"Theo" wrote:

But I only want to paste the validation and the format?


"Per Jessen" wrote:


"Theo" skrev i en meddelelse
...
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




Gary Keramidas[_2_]

Macro Help - ASAP - Please!
 
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


--

Gary


"Theo" wrote in message
...
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



theo

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

"Gary Keramidas" wrote:

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


--

Gary


"Theo" wrote in message
...
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





All times are GMT +1. The time now is 01:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com