grabbing and pasting cell formats

N

Nunya

Hey guys.

I have a macro which grabs a font selection and injects it into a
cell dynamically. I want to do the same thing with cell color
formatting. I currently use a drop down list to set the value of a
couple of variables which I use in the macro. I want to do the same
thing with the ability to grab a cell's color value, then assign it to
the target cell.

My Font grabbing code is quoted below. I think I only need a slight
variant of that, but am not sure. See if you can re-direct my code
use better, please.
Place this code in your VB editor to make the ZAP symbol work right.

Sub FlipFont()
'
' FlipFont Macro
' Gathering the value of a cell does not gather the font
'
Range("I4").Select
With Selection.Font
.Name = Range("H5").Value
.Size = 112
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub

I think that if I can inject the "ThemeColor" value, I can get what I
need. So all I should have to do is replace the hard coded value with
a dynamic string. Any help greatly appreciated.
 
S

StickThatInYourPipeAndSmokeIt

Hey guys.

I have a macro which grabs a font selection and injects it into a
cell dynamically. I want to do the same thing with cell color
formatting. I currently use a drop down list to set the value of a
couple of variables which I use in the macro. I want to do the same
thing with the ability to grab a cell's color value, then assign it to
the target cell.

My Font grabbing code is quoted below. I think I only need a slight
variant of that, but am not sure. See if you can re-direct my code
use better, please.
Place this code in your VB editor to make the ZAP symbol work right.

Sub FlipFont()
'
' FlipFont Macro
' Gathering the value of a cell does not gather the font
'
Range("I4").Select
With Selection.Font
.Name = Range("H5").Value
.Size = 112
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
End Sub

I think that if I can inject the "ThemeColor" value, I can get what I
need. So all I should have to do is replace the hard coded value with
a dynamic string. Any help greatly appreciated.

I ended up using conditional formatting to make the cell the desired
color based on its value.

It was a lot of data validation entries to make, but it did do the job.

Still some code for "popping" a cell color change based on other dynamic
data or cell values would be nice to come up with. I will post a link to
the workbook when I get closer to being done with it.
 
S

StickThatInYourPipeAndSmokeIt

I ended up using conditional formatting to make the cell the desired
color based on its value.

It was a lot of data validation entries to make, but it did do the job.

Still some code for "popping" a cell color change based on other dynamic
data or cell values would be nice to come up with. I will post a link to
the workbook when I get closer to being done with it.

This is the start...

I am having trouble with decimal placement ("R") and adding zeros to
derive the Euro designations. They are similar to the US code I used,
but the decimals all get replaced with a capital R, so I do not know how
to do that little bit.

http://www.mediafire.com/file/nmt2itemkm1/resistor_decoder.xltx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top