ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PasteSpecial xlPasteFormats (https://www.excelbanter.com/excel-programming/394026-pastespecial-xlpasteformats.html)

Josh O.

PasteSpecial xlPasteFormats
 
I have the below code to insert a conditional format into cell H2 and then
copy it from cell h3 to the last row with data in column h. But the
resulting conditional format ends up with this formula in each non-blank cell
in column h:
=$H65325="Unsigned but Inserted"

Macro:
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex
= 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With

Gary Keramidas

PasteSpecial xlPasteFormats
 
this is one of the times i've found it necessary to actually select a cell while
performing some action.

see if this works

With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex = 3
End With
With Range("h2")
.Copy
Range("h3").Select
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With

--


Gary


"Josh O." wrote in message
...
I have the below code to insert a conditional format into cell H2 and then
copy it from cell h3 to the last row with data in column h. But the
resulting conditional format ends up with this formula in each non-blank cell
in column h:
=$H65325="Unsigned but Inserted"

Macro:
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex
= 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With




Josh O.

PasteSpecial xlPasteFormats
 
Didn't work. Same result.

"Gary Keramidas" wrote:

this is one of the times i've found it necessary to actually select a cell while
performing some action.

see if this works

With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex = 3
End With
With Range("h2")
.Copy
Range("h3").Select
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With

--


Gary


"Josh O." wrote in message
...
I have the below code to insert a conditional format into cell H2 and then
copy it from cell h3 to the last row with data in column h. But the
resulting conditional format ends up with this formula in each non-blank cell
in column h:
=$H65325="Unsigned but Inserted"

Macro:
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex
= 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With





Gary Keramidas

PasteSpecial xlPasteFormats
 

try selecting h2 first, i didn't test what i posted the first time and selected
the wrong cell. see if this works, it worked for me:

Range("h2").Select
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex = 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With
--


Gary


"Josh O." wrote in message
...
Didn't work. Same result.

"Gary Keramidas" wrote:

this is one of the times i've found it necessary to actually select a cell
while
performing some action.

see if this works

With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex =
3
End With
With Range("h2")
.Copy
Range("h3").Select
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With

--


Gary


"Josh O." wrote in message
...
I have the below code to insert a conditional format into cell H2 and then
copy it from cell h3 to the last row with data in column h. But the
resulting conditional format ends up with this formula in each non-blank
cell
in column h:
=$H65325="Unsigned but Inserted"

Macro:
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex
= 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With







Josh O.

PasteSpecial xlPasteFormats
 
Yes it worked that time. Thanks Gary.

"Gary Keramidas" wrote:


try selecting h2 first, i didn't test what i posted the first time and selected
the wrong cell. see if this works, it worked for me:

Range("h2").Select
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex = 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With
--


Gary


"Josh O." wrote in message
...
Didn't work. Same result.

"Gary Keramidas" wrote:

this is one of the times i've found it necessary to actually select a cell
while
performing some action.

see if this works

With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex =
3
End With
With Range("h2")
.Copy
Range("h3").Select
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With

--


Gary


"Josh O." wrote in message
...
I have the below code to insert a conditional format into cell H2 and then
copy it from cell h3 to the last row with data in column h. But the
resulting conditional format ends up with this formula in each non-blank
cell
in column h:
=$H65325="Unsigned but Inserted"

Macro:
With Range("h2").FormatConditions
.Delete
.Add(xlExpression, , "=$h2=""Unsigned but Inserted""").Font.ColorIndex
= 3
End With
With Range("h2")
.Copy
Range("h3:h" & Range("h65000").End(xlUp).Offset(0, 0).Row).PasteSpecial
xlPasteFormats
Application.CutCopyMode = False
End With








All times are GMT +1. The time now is 04:01 PM.

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