ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Store the format of a cell in a variable (https://www.excelbanter.com/excel-programming/388243-store-format-cell-variable.html)

Dave

Store the format of a cell in a variable
 
Is there any way to store the format of a certain cell into a variable? For
example:

frmt = Range("A1").format

.... Then I could do something like:

function sum_format(rng)
for each rn in rng
if (rn.format = frmt) then
temp = temp + rn
end if
next
sum_format = temp
end function

In which the function would sum all cells that only have the format as cell A1

PCLIVE

Store the format of a cell in a variable
 
I'm sure you could do something like that...however, there are many formats
to a cell and I believe you may have to reference them individually in your
code. Just a guess though.


"Dave" wrote in message
...
Is there any way to store the format of a certain cell into a variable?
For
example:

frmt = Range("A1").format

... Then I could do something like:

function sum_format(rng)
for each rn in rng
if (rn.format = frmt) then
temp = temp + rn
end if
next
sum_format = temp
end function

In which the function would sum all cells that only have the format as
cell A1




tbone[_2_]

Store the format of a cell in a variable
 
I agree - you have to pick one or more specific format items. For
example, I've used interior.colorindex for a similar purpose.

HTH
tbone

On Thu, 26 Apr 2007 17:33:50 -0400, "PCLIVE"
wrote:

I'm sure you could do something like that...however, there are many formats
to a cell and I believe you may have to reference them individually in your
code. Just a guess though.


"Dave" wrote in message
...
Is there any way to store the format of a certain cell into a variable?
For
example:

frmt = Range("A1").format

... Then I could do something like:

function sum_format(rng)
for each rn in rng
if (rn.format = frmt) then
temp = temp + rn
end if
next
sum_format = temp
end function

In which the function would sum all cells that only have the format as
cell A1




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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com