PC Review


Reply
Thread Tools Rate Thread

Dynamic Cell Format

 
 
cdil
Guest
Posts: n/a
 
      29th Nov 2006
Hello everyone,

I am creating a sub that takes the value of a range into another one as
a formula
i.e. Range("TargetCell").FormulaR1C1 "=SourceCell"
So it can be updated automatically when SourceCell changes.

I would like to know if it is possible to copy or get the format of the
SourceCell to apply it also to the TargetCell.

For example:
SourceCell value is "Hello John" with the word "John" in bold
characters.
Currently, TargetCell will display "Hello John" without the bold
characters.

How can I do to also get the word "John" in bold characters while
keeping the "dynamicity" of the cell ?

Thanks you for your help !

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      29th Nov 2006
If you leave the formula in the cell, then you can't use this character by
character formatting.

If you could use values, you could copy|paste.

cdil wrote:
>
> Hello everyone,
>
> I am creating a sub that takes the value of a range into another one as
> a formula
> i.e. Range("TargetCell").FormulaR1C1 "=SourceCell"
> So it can be updated automatically when SourceCell changes.
>
> I would like to know if it is possible to copy or get the format of the
> SourceCell to apply it also to the TargetCell.
>
> For example:
> SourceCell value is "Hello John" with the word "John" in bold
> characters.
> Currently, TargetCell will display "Hello John" without the bold
> characters.
>
> How can I do to also get the word "John" in bold characters while
> keeping the "dynamicity" of the cell ?
>
> Thanks you for your help !


--

Dave Peterson
 
Reply With Quote
 
WhytheQ
Guest
Posts: n/a
 
      29th Nov 2006
if A1 is in bold but B1 isn't then you can do something like:

range("A1").copy
range("B1").pastespecial xlformats

Rgds
J

On 29 Nov, 15:10, "cdil" <cdil1...@gmail.com> wrote:
> Hello everyone,
>
> I am creating a sub that takes the value of a range into another one as
> a formula
> i.e. Range("TargetCell").FormulaR1C1 "=SourceCell"
> So it can be updated automatically when SourceCell changes.
>
> I would like to know if it is possible to copy or get the format of the
> SourceCell to apply it also to the TargetCell.
>
> For example:
> SourceCell value is "Hello John" with the word "John" in bold
> characters.
> Currently, TargetCell will display "Hello John" without the bold
> characters.
>
> How can I do to also get the word "John" in bold characters while
> keeping the "dynamicity" of the cell ?
>
> Thanks you for your help !


 
Reply With Quote
 
cdil
Guest
Posts: n/a
 
      29th Nov 2006
Thanks guy for your help
Unfortunatelly with a copy & paste (even by pasting only formats), I
can't preserve the "dynamicity"

Other ideas ?


WhytheQ wrote:
> if A1 is in bold but B1 isn't then you can do something like:
>
> range("A1").copy
> range("B1").pastespecial xlformats
>
> Rgds
> J
>
> On 29 Nov, 15:10, "cdil" <cdil1...@gmail.com> wrote:
> > Hello everyone,
> >
> > I am creating a sub that takes the value of a range into another one as
> > a formula
> > i.e. Range("TargetCell").FormulaR1C1 "=SourceCell"
> > So it can be updated automatically when SourceCell changes.
> >
> > I would like to know if it is possible to copy or get the format of the
> > SourceCell to apply it also to the TargetCell.
> >
> > For example:
> > SourceCell value is "Hello John" with the word "John" in bold
> > characters.
> > Currently, TargetCell will display "Hello John" without the bold
> > characters.
> >
> > How can I do to also get the word "John" in bold characters while
> > keeping the "dynamicity" of the cell ?
> >
> > Thanks you for your help !


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      29th Nov 2006
If the original cell is changing because of typing, you could use a
worksheet_change event to do the copy|paste (and formats) for you.

If the original cell is changing because of a calculation/formula, then you
could use a worksheet_calculate event to do the copy|paste (and formats) for
you.

But both of these mean that the "receiving" cell will not contain a formula.

cdil wrote:
>
> Thanks guy for your help
> Unfortunatelly with a copy & paste (even by pasting only formats), I
> can't preserve the "dynamicity"
>
> Other ideas ?
>
> WhytheQ wrote:
> > if A1 is in bold but B1 isn't then you can do something like:
> >
> > range("A1").copy
> > range("B1").pastespecial xlformats
> >
> > Rgds
> > J
> >
> > On 29 Nov, 15:10, "cdil" <cdil1...@gmail.com> wrote:
> > > Hello everyone,
> > >
> > > I am creating a sub that takes the value of a range into another one as
> > > a formula
> > > i.e. Range("TargetCell").FormulaR1C1 "=SourceCell"
> > > So it can be updated automatically when SourceCell changes.
> > >
> > > I would like to know if it is possible to copy or get the format of the
> > > SourceCell to apply it also to the TargetCell.
> > >
> > > For example:
> > > SourceCell value is "Hello John" with the word "John" in bold
> > > characters.
> > > Currently, TargetCell will display "Hello John" without the bold
> > > characters.
> > >
> > > How can I do to also get the word "John" in bold characters while
> > > keeping the "dynamicity" of the cell ?
> > >
> > > Thanks you for your help !


--

Dave Peterson
 
Reply With Quote
 
cdil
Guest
Posts: n/a
 
      6th Dec 2006
That solution worked out perfectly
Thanks a lot !


Jim Thomlinson a écrit :

> This is about a close as you will get. It will be dynaic in terms of updating
> the formats when the active cell is moved. If you update the format of the
> source cell or change the address so the source cell the target cell willbe
> updated as soon as the active cell is changed. Place this code directly into
> the sheet (right click the sheet tab and select view code)...
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> Range("SourceCell").Copy Range("TargetCell")
> Range("TargetCell").Formula = "=SourceCell"
> End Sub
> --
> HTH...
>
> Jim Thomlinson
>
>
> "cdil" wrote:
>
> > Hello everyone,
> >
> > I am creating a sub that takes the value of a range into another one as
> > a formula
> > i.e. Range("TargetCell").FormulaR1C1 "=SourceCell"
> > So it can be updated automatically when SourceCell changes.
> >
> > I would like to know if it is possible to copy or get the format of the
> > SourceCell to apply it also to the TargetCell.
> >
> > For example:
> > SourceCell value is "Hello John" with the word "John" in bold
> > characters.
> > Currently, TargetCell will display "Hello John" without the bold
> > characters.
> >
> > How can I do to also get the word "John" in bold characters while
> > keeping the "dynamicity" of the cell ?
> >
> > Thanks you for your help !
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
cell format -> remove cell format pattern without effecting colors Bas Microsoft Excel Misc 1 23rd Mar 2009 02:54 PM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Microsoft Excel Discussion 0 1st Mar 2006 01:05 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Microsoft Excel Programming 0 1st Mar 2006 01:05 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Microsoft Excel Charting 0 1st Mar 2006 01:05 AM
How do I copy data in single cell format to a merged cell format =?Utf-8?B?UGF1bA==?= Microsoft Excel Misc 1 27th Jun 2005 11:00 AM


Features
 

Advertising
 

Newsgroups
 


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