|
|
| Next: MS Word 2007 doc only prints 3/4 page |
| Author |
Message |
KRK External

Since: Mar 15, 2009 Posts: 4
|
Posted: Fri Oct 23, 2009 9:10 am Post subject: auto copy cell format Archived from groups: microsoft>public>excel>newusers (more info?) |
|
|
Hello,
I have a complex spreadsheet in which I use cell formatting (shading) to
illustrate where one cell value is being copied elsewhere in the same sheet.
So for example I have a value 2.34 in cell C3 which is shaded pink, and
another cell G24 also 2.34 also shaded pink. It is helpful for display
purposes.
I can set G24 to 2.34 just by setting the cell '=C3'. But can I set it to
pink in a similar way?
I have Excell 2007.
I know how to copy a cell format using the format painter, no problem. But I
have several cell connections of this sort and an automated way of doing it
would be nice.
Thanks
KK |
|
| Back to top |
|
 |
Gary''s Student External

Since: Oct 01, 2005 Posts: 3350
|
Posted: Fri Oct 23, 2009 9:10 am Post subject: RE: auto copy cell format [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Install the following event macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t As Range, s As String, v As String, l As Long
Dim core As String
Dim FromWhere As Range
Set FromWhere = Nothing
Set t = Target
If Not t.HasFormula Then Exit Sub
v = t.Formula
l = Len(v) - 1
core = Right(v, l)
On Error Resume Next
Set FromWhere = Range(core)
If FromWhere Is Nothing Then Exit Sub
FromWhere.Copy
Application.EnableEvents = False
t.PasteSpecial Paste:=xlPasteFormats
Application.EnableEvents = True
End Sub
Once installed, if you enter a simple linking formula in a cell like:
=Z100
then the format of Z100 will be copied to the cell containing the formula.
Because it is worksheet code, it is very easy to install and use:
1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
--
Gary''s Student - gsnu200908
"KRK" wrote:
> Hello,
>
> I have a complex spreadsheet in which I use cell formatting (shading) to
> illustrate where one cell value is being copied elsewhere in the same sheet.
> So for example I have a value 2.34 in cell C3 which is shaded pink, and
> another cell G24 also 2.34 also shaded pink. It is helpful for display
> purposes.
>
> I can set G24 to 2.34 just by setting the cell '=C3'. But can I set it to
> pink in a similar way?
>
> I have Excell 2007.
>
> I know how to copy a cell format using the format painter, no problem. But I
> have several cell connections of this sort and an automated way of doing it
> would be nice.
>
> Thanks
>
> KK
>
> .
> |
|
| Back to top |
|
 |
Gord Dibben External

Since: Feb 23, 2004 Posts: 9178
|
Posted: Fri Oct 23, 2009 9:10 am Post subject: Re: auto copy cell format [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Can you use Conditional Formatting on source cell C3 to show pink?
Then use same CF on G24
Gord Dibben MS Excel MVP
On Fri, 23 Oct 2009 12:51:53 +0100, "KRK"
<trebor RemoveThis @yeleek.nospam.freeserve.co.uk> wrote:
>Hello,
>
>I have a complex spreadsheet in which I use cell formatting (shading) to
>illustrate where one cell value is being copied elsewhere in the same sheet.
>So for example I have a value 2.34 in cell C3 which is shaded pink, and
>another cell G24 also 2.34 also shaded pink. It is helpful for display
>purposes.
>
>I can set G24 to 2.34 just by setting the cell '=C3'. But can I set it to
>pink in a similar way?
>
>I have Excell 2007.
>
>I know how to copy a cell format using the format painter, no problem. But I
>have several cell connections of this sort and an automated way of doing it
>would be nice.
>
>Thanks
>
>KK |
|
| Back to top |
|
 |
KRK External

Since: Mar 15, 2009 Posts: 4
|
Posted: Sat Oct 24, 2009 8:10 am Post subject: Re: auto copy cell format - Thanks [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Thanks, there are some good ideas here.
K
"KRK" <trebor.TakeThisOut@yeleek.nospam.freeserve.co.uk> wrote in message
news:OpQX0c9UKHA.1236@TK2MSFTNGP05.phx.gbl...
> Hello,
>
> I have a complex spreadsheet in which I use cell formatting (shading) to
> illustrate where one cell value is being copied elsewhere in the same
> sheet. So for example I have a value 2.34 in cell C3 which is shaded pink,
> and another cell G24 also 2.34 also shaded pink. It is helpful for display
> purposes.
>
> I can set G24 to 2.34 just by setting the cell '=C3'. But can I set it to
> pink in a similar way?
>
> I have Excell 2007.
>
> I know how to copy a cell format using the format painter, no problem. But
> I have several cell connections of this sort and an automated way of doing
> it would be nice.
>
> Thanks
>
> KK |
|
| Back to top |
|
 |
Carisa Ventura External

Since: Nov 07, 2009 Posts: 1
|
Posted: Sat Nov 07, 2009 6:12 pm Post subject: error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
So I tried this on a worksheet and I got an error.... run time error '13' Type mismatch... which brought me to v = t.Formula where I guess the error began.
I'm new using visual basic, so if you could tell me what is wrong that would be great!
Gary''s Student wrote:
Install the following event macro in the worksheet code area:Private Sub
23-Oct-09
Install the following event macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t As Range, s As String, v As String, l As Long
Dim core As String
Dim FromWhere As Range
Set FromWhere = Nothing
Set t = Target
If Not t.HasFormula Then Exit Sub
v = t.Formula
l = Len(v) - 1
core = Right(v, l)
On Error Resume Next
Set FromWhere = Range(core)
If FromWhere Is Nothing Then Exit Sub
FromWhere.Copy
Application.EnableEvents = False
t.PasteSpecial Paste:=xlPasteFormats
Application.EnableEvents = True
End Sub
Once installed, if you enter a simple linking formula in a cell like:
=Z100
then the format of Z100 will be copied to the cell containing the formula.
Because it is worksheet code, it is very easy to install and use:
1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
--
Gary''s Student - gsnu200908
"KRK" wrote:
Previous Posts In This Thread:
On Friday, October 23, 2009 7:51 AM
KRK wrote:
auto copy cell format
Hello,
I have a complex spreadsheet in which I use cell formatting (shading) to
illustrate where one cell value is being copied elsewhere in the same sheet.
So for example I have a value 2.34 in cell C3 which is shaded pink, and
another cell G24 also 2.34 also shaded pink. It is helpful for display
purposes.
I can set G24 to 2.34 just by setting the cell '=C3'. But can I set it to
pink in a similar way?
I have Excell 2007.
I know how to copy a cell format using the format painter, no problem. But I
have several cell connections of this sort and an automated way of doing it
would be nice.
Thanks
KK
On Friday, October 23, 2009 9:28 AM
Gary''s Student wrote:
Install the following event macro in the worksheet code area:Private Sub
Install the following event macro in the worksheet code area:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim t As Range, s As String, v As String, l As Long
Dim core As String
Dim FromWhere As Range
Set FromWhere = Nothing
Set t = Target
If Not t.HasFormula Then Exit Sub
v = t.Formula
l = Len(v) - 1
core = Right(v, l)
On Error Resume Next
Set FromWhere = Range(core)
If FromWhere Is Nothing Then Exit Sub
FromWhere.Copy
Application.EnableEvents = False
t.PasteSpecial Paste:=xlPasteFormats
Application.EnableEvents = True
End Sub
Once installed, if you enter a simple linking formula in a cell like:
=Z100
then the format of Z100 will be copied to the cell containing the formula.
Because it is worksheet code, it is very easy to install and use:
1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window
If you save the workbook, the macro will be saved with it.
To remove the macro:
1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window
To learn more about macros in general, see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
To learn more about Event Macros (worksheet code), see:
http://www.mvps.org/dmcritchie/excel/event.htm
--
Gary''s Student - gsnu200908
"KRK" wrote:
On Friday, October 23, 2009 9:31 AM
Mattlynn via OfficeKB.com wrote:
Have you considered precedent/dependent arrowsKRK wrote:--Matt LynnMessage
Have you considered precedent/dependent arrows
KRK wrote:
--
Matt Lynn
Message posted via http://www.officekb.com
On Friday, October 23, 2009 10:47 AM
Gord Dibben wrote:
Can you use Conditional Formatting on source cell C3 to show pink?
Can you use Conditional Formatting on source cell C3 to show pink?
Then use same CF on G24
Gord Dibben MS Excel MVP
On Saturday, October 24, 2009 7:04 AM
KRK wrote:
Thanks, there are some good ideas here.K
Thanks, there are some good ideas here.
K
EggHeadCafe - Software Developer Portal of Choice
Delegates to the Event
http://www.eggheadcafe.com/tutorials/aspnet/0fa76661-00cb-4777-810a-6c...ed2ca82 |
|
| Back to top |
|
 |
Don Guillett External

Since: Jan 04, 2006 Posts: 2988
|
Posted: Sun Nov 08, 2009 7:55 am Post subject: Re: error [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
One. You should stay in the ORIGINAL thread. I just tested the code and it
worked properly. Did you copy into a SHEET module
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1.DeleteThis@austin.rr.com
"Carisa Ventura" wrote in message
news:2009117211214carisaventura@gmail.com...
> So I tried this on a worksheet and I got an error.... run time error '13'
> Type mismatch... which brought me to v = t.Formula where I guess the error
> began.
>
> I'm new using visual basic, so if you could tell me what is wrong that
> would be great!
>
>
>
>
> Gary''s Student wrote:
>
> Install the following event macro in the worksheet code area:Private Sub
> 23-Oct-09
>
> Install the following event macro in the worksheet code area:
>
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> Dim t As Range, s As String, v As String, l As Long
> Dim core As String
> Dim FromWhere As Range
>
> Set FromWhere = Nothing
> Set t = Target
> If Not t.HasFormula Then Exit Sub
> v = t.Formula
> l = Len(v) - 1
> core = Right(v, l)
> On Error Resume Next
> Set FromWhere = Range(core)
> If FromWhere Is Nothing Then Exit Sub
> FromWhere.Copy
> Application.EnableEvents = False
> t.PasteSpecial Paste:=xlPasteFormats
> Application.EnableEvents = True
> End Sub
>
> Once installed, if you enter a simple linking formula in a cell like:
>
> =Z100
>
> then the format of Z100 will be copied to the cell containing the formula.
>
>
> Because it is worksheet code, it is very easy to install and use:
>
> 1. right-click the tab name near the bottom of the window
> 2. select View Code - this brings up a VBE window
> 3. paste the stuff in and close the VBE window
>
> If you save the workbook, the macro will be saved with it.
>
> To remove the macro:
>
> 1. bring up the VBE windows as above
> 2. clear the code out
> 3. close the VBE window
>
> To learn more about macros in general, see:
>
> http://www.mvps.org/dmcritchie/excel/getstarted.htm
>
> To learn more about Event Macros (worksheet code), see:
>
> http://www.mvps.org/dmcritchie/excel/event.htm
>
>
> --
> Gary''s Student - gsnu200908
>
>
> "KRK" wrote:
>
> Previous Posts In This Thread:
>
> On Friday, October 23, 2009 7:51 AM
> KRK wrote:
>
> auto copy cell format
> Hello,
>
> I have a complex spreadsheet in which I use cell formatting (shading) to
> illustrate where one cell value is being copied elsewhere in the same
> sheet.
> So for example I have a value 2.34 in cell C3 which is shaded pink, and
> another cell G24 also 2.34 also shaded pink. It is helpful for display
> purposes.
>
> I can set G24 to 2.34 just by setting the cell '=C3'. But can I set it to
> pink in a similar way?
>
> I have Excell 2007.
>
> I know how to copy a cell format using the format painter, no problem. But
> I
> have several cell connections of this sort and an automated way of doing
> it
> would be nice.
>
> Thanks
>
> KK
>
> On Friday, October 23, 2009 9:28 AM
> Gary''s Student wrote:
>
> Install the following event macro in the worksheet code area:Private Sub
> Install the following event macro in the worksheet code area:
>
>
> Private Sub Worksheet_Change(ByVal Target As Range)
>
> Dim t As Range, s As String, v As String, l As Long
> Dim core As String
> Dim FromWhere As Range
>
> Set FromWhere = Nothing
> Set t = Target
> If Not t.HasFormula Then Exit Sub
> v = t.Formula
> l = Len(v) - 1
> core = Right(v, l)
> On Error Resume Next
> Set FromWhere = Range(core)
> If FromWhere Is Nothing Then Exit Sub
> FromWhere.Copy
> Application.EnableEvents = False
> t.PasteSpecial Paste:=xlPasteFormats
> Application.EnableEvents = True
> End Sub
>
> Once installed, if you enter a simple linking formula in a cell like:
>
> =Z100
>
> then the format of Z100 will be copied to the cell containing the formula.
>
>
> Because it is worksheet code, it is very easy to install and use:
>
> 1. right-click the tab name near the bottom of the window
> 2. select View Code - this brings up a VBE window
> 3. paste the stuff in and close the VBE window
>
> If you save the workbook, the macro will be saved with it.
>
> To remove the macro:
>
> 1. bring up the VBE windows as above
> 2. clear the code out
> 3. close the VBE window
>
> To learn more about macros in general, see:
>
> http://www.mvps.org/dmcritchie/excel/getstarted.htm
>
> To learn more about Event Macros (worksheet code), see:
>
> http://www.mvps.org/dmcritchie/excel/event.htm
>
>
> --
> Gary''s Student - gsnu200908
>
>
> "KRK" wrote:
>
> On Friday, October 23, 2009 9:31 AM
> Mattlynn via OfficeKB.com wrote:
>
> Have you considered precedent/dependent arrowsKRK wrote:--Matt LynnMessage
> Have you considered precedent/dependent arrows
>
> KRK wrote:
>
> --
> Matt Lynn
>
> Message posted via http://www.officekb.com
>
> On Friday, October 23, 2009 10:47 AM
> Gord Dibben wrote:
>
> Can you use Conditional Formatting on source cell C3 to show pink?
> Can you use Conditional Formatting on source cell C3 to show pink?
>
> Then use same CF on G24
>
>
> Gord Dibben MS Excel MVP
>
> On Saturday, October 24, 2009 7:04 AM
> KRK wrote:
>
> Thanks, there are some good ideas here.K
> Thanks, there are some good ideas here.
>
> K
>
> EggHeadCafe - Software Developer Portal of Choice
> Delegates to the Event
> http://www.eggheadcafe.com/tutorials/aspnet/0fa76661-00cb-4777-810a-6c...ed2ca82 |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|