![]() |
Format problem
Below is a piece of my code:
If Cell.Offset(0, -1).Value < "Comment:" Then WSSD.Cells(rw, "A") = Cell.Offset(0, -1) WSSD.Cells(rw, "A").InsertIndent 3 rw = rw + 1 End If My problem is that I want WSSD.Cells(rw,"A") to have the same format as Cell.Offset(0,-1). However, I want to do this without copying and pasteing, selecting or activating. Is that possible? -- Thanks Shawn |
Format problem
There are a lot of formatting options that you'd have to assign. Font size/font
name/italics, underlining, fill color, borders.... If you know exactly which of those you want to use, then you could just assign them in code: CellA.numberformat = cellb.numberformat cellA.font.name = cellb.font.name cellA.font.size = cellb.font.size ....and so forth Why not just cellb.copy cella.pastespecial paste:=xlpasteformats Shawn wrote: Below is a piece of my code: If Cell.Offset(0, -1).Value < "Comment:" Then WSSD.Cells(rw, "A") = Cell.Offset(0, -1) WSSD.Cells(rw, "A").InsertIndent 3 rw = rw + 1 End If My problem is that I want WSSD.Cells(rw,"A") to have the same format as Cell.Offset(0,-1). However, I want to do this without copying and pasteing, selecting or activating. Is that possible? -- Thanks Shawn -- Dave Peterson |
Format problem
On Mon, 18 Jun 2007 18:37:01 -0700, Shawn
wrote: Below is a piece of my code: If Cell.Offset(0, -1).Value < "Comment:" Then WSSD.Cells(rw, "A") = Cell.Offset(0, -1) WSSD.Cells(rw, "A").InsertIndent 3 rw = rw + 1 End If My problem is that I want WSSD.Cells(rw,"A") to have the same format as Cell.Offset(0,-1). However, I want to do this without copying and pasteing, selecting or activating. Is that possible? If you don't want to copy/paste, and I'm not sure why you want to avoid that, you could do something like: with WSSD.Cells(rw,"A") .numberformat = cell.offset(0,-1) and so on for all of the other formatted parameters. It would seem simpler to do something like cell.offset(0,-1).copy wssd.cells(rw,"A").PasteSpecial Paste:=xlPasteFormats --ron |
Format problem
On Mon, 18 Jun 2007 22:08:29 -0400, Ron Rosenfeld
wrote: On Mon, 18 Jun 2007 18:37:01 -0700, Shawn wrote: Below is a piece of my code: If Cell.Offset(0, -1).Value < "Comment:" Then WSSD.Cells(rw, "A") = Cell.Offset(0, -1) WSSD.Cells(rw, "A").InsertIndent 3 rw = rw + 1 End If My problem is that I want WSSD.Cells(rw,"A") to have the same format as Cell.Offset(0,-1). However, I want to do this without copying and pasteing, selecting or activating. Is that possible? If you don't want to copy/paste, and I'm not sure why you want to avoid that, you could do something like: with WSSD.Cells(rw,"A") .numberformat = cell.offset(0,-1) and so on for all of the other formatted parameters. It would seem simpler to do something like cell.offset(0,-1).copy wssd.cells(rw,"A").PasteSpecial Paste:=xlPasteFormats --ron Ooops, that should have been: with WSSD.Cells(rw,"A") .numberformat = cell.offset(0,-1).numberformat and so on for all of the other formatted parameters. --ron |
All times are GMT +1. The time now is 02:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com