Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
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
Excel Format Problem - Date Overrides Format Mary Excel Discussion (Misc queries) 5 February 10th 10 05:49 AM
General Format to Custom format problem KELC-F/A Excel Discussion (Misc queries) 1 May 2nd 08 09:51 PM
Format problem Sapphyre Excel Discussion (Misc queries) 13 August 22nd 07 04:52 PM
format problem bz Excel Programming 3 November 21st 06 05:37 PM
Format Problem randy Excel Programming 3 August 25th 06 02:35 PM


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

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"