Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default 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








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why need to use Selection.PasteSpecial vs myRange.PasteSpecial [email protected] Excel Programming 4 June 25th 07 05:34 PM
PasteSpecial Paste:= xlPasteFormats problem Ken Johnson Excel Programming 4 March 21st 06 11:25 AM
PasteSpecial xlPasteFormats ends macro itarnak Excel Programming 4 October 12th 05 02:44 PM
Pastespecial and cut Ron[_23_] Excel Programming 4 April 26th 04 02:14 AM
vba pastespecial joao Excel Programming 2 November 14th 03 03:31 PM


All times are GMT +1. The time now is 04:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"