#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Font Object

How do I set the font property of a cell / range to be the same as a
reference cell, without going through all the myriad of font properties and
setting individually

I have tried all manner of variations on the theme:

dim oFont as Font

set oFont = RefRange.Font
TargetCell.Font = oFont

Does not work and all manner of mucking around has not improved results

Thanks

Jack
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Font Object

Try this piece of code for copying format of cell A1 to B1:

Range("A1").Copy
Range("B1").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False

Regards,
Stefi


€˛Jack Clift€¯ ezt Ć*rta:

How do I set the font property of a cell / range to be the same as a
reference cell, without going through all the myriad of font properties and
setting individually

I have tried all manner of variations on the theme:

dim oFont as Font

set oFont = RefRange.Font
TargetCell.Font = oFont

Does not work and all manner of mucking around has not improved results

Thanks

Jack

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Font Object

You can't copy the font object in one go. So other than PasteSpecial formats
as suggested by Stefi, which could also copy up to 30 other non font related
cell properties, you're stuck with setting font attributes individually.

Regards,
Peter T

"Jack Clift" wrote in message
...
How do I set the font property of a cell / range to be the same as a
reference cell, without going through all the myriad of font properties

and
setting individually

I have tried all manner of variations on the theme:

dim oFont as Font

set oFont = RefRange.Font
TargetCell.Font = oFont

Does not work and all manner of mucking around has not improved results

Thanks

Jack



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Font Object

Thanks Stefi and Peter,

Can either of you provide an explanation as to why you cannot assign the
font object as per any other object? Just for my info?

Will use solution as suggested

Thanks for the timely reply

Regards

JC


"Peter T" wrote:

You can't copy the font object in one go. So other than PasteSpecial formats
as suggested by Stefi, which could also copy up to 30 other non font related
cell properties, you're stuck with setting font attributes individually.

Regards,
Peter T

"Jack Clift" wrote in message
...
How do I set the font property of a cell / range to be the same as a
reference cell, without going through all the myriad of font properties

and
setting individually

I have tried all manner of variations on the theme:

dim oFont as Font

set oFont = RefRange.Font
TargetCell.Font = oFont

Does not work and all manner of mucking around has not improved results

Thanks

Jack




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Font Object

Default property excepting, I can't think of any object type you can simply
assign to another object in the way you suggest, could you give an example
of what you had in mind.

Regards,
Peter T



"Jack Clift" wrote in message
...
Thanks Stefi and Peter,

Can either of you provide an explanation as to why you cannot assign the
font object as per any other object? Just for my info?

Will use solution as suggested

Thanks for the timely reply

Regards

JC


"Peter T" wrote:

You can't copy the font object in one go. So other than PasteSpecial

formats
as suggested by Stefi, which could also copy up to 30 other non font

related
cell properties, you're stuck with setting font attributes individually.

Regards,
Peter T

"Jack Clift" wrote in message
...
How do I set the font property of a cell / range to be the same as a
reference cell, without going through all the myriad of font

properties
and
setting individually

I have tried all manner of variations on the theme:

dim oFont as Font

set oFont = RefRange.Font
TargetCell.Font = oFont

Does not work and all manner of mucking around has not improved

results

Thanks

Jack






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
Syntax for changing font color in a Shapes object Ben Excel Programming 3 October 29th 06 06:28 PM
Changed default font, previous font still shows when editing Font/Editing Problem Excel Discussion (Misc queries) 1 May 19th 06 12:46 PM
Changed default font, previous font still shows when editing Font/Editing Problem Excel Discussion (Misc queries) 0 May 18th 06 04:37 PM
VBA Font Object Query Robert Mulroney[_3_] Excel Programming 4 October 21st 05 11:18 AM
Dropdown list for font size, font type and number formats ExcelMonkey[_190_] Excel Programming 1 March 9th 05 03:50 PM


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

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

About Us

"It's about Microsoft Excel"