cell properties sniffer?

jayd4wg

Board Regular
Joined
Mar 25, 2005
Messages
197
has anyone ever written a cell properties sniffer?

I'm trying to do a simple text and background color inverter, and when i go to white background with black text, i lose the fine gray outline. But later on, i'll be doing much more with it and it would be very helpful to know what the VBA properties are for certain cells.
 
Mabye if I clarify a little better..

What I'm wondering is if there is a way to loop through all of the possible properties of the Range object (or any other object for that matter).

I was hoping that there was a container object that held all of the available properties that we could just loop through, kinda' like an array or a range of multiple cells

Ex.
For Each cell in activesheet.range("a1:d12")
cell.value=1
next cell

Does anyone know if such an object exisits? Failing that, I guess we would have to manually code a line for each and every property.

I'm going to send a link to this tread over to **** at Daily Dose of Excel (http://www.dicks-blog.com/)and see if he knows of anything...
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Yes, chead5,
it was clear to me

Code:
Sub list_cell_properties()
For Each P in ActiveCell.Properties
msg = msg & P & vTab & P.Value & Chr(10)
Next P
Range("A1") = msg
'MsgBox msg
End Sub

this it not working, but shows the intention :)

kind regards,
Erik
 
Upvote 0
Unfortunatly I have just been assigned a dealine project that will have to take priority for now. I will get back to this in a couple of days....
 
Upvote 0
Probably not really useful, but a neat trick. Go to Insert | Names | Define. Make the name Info (can be any valid name). In the refers to box enter.
Code:
=GET.CELL(ROW(),Sheet1!$A$1)
In B1 enter.
Code:
=Info
And drag down. This is what you get. I added the text from the help file.
Book1
ABCD
1$A$1Absolute reference of the upper-left cell in reference, as text in the current workspace reference style.
21Row number of the top cell in reference.
31Column number of the leftmost cell in reference.
41Same as TYPE(reference).
50Contents of reference.
6 Formula in reference, as text, in either A1 or R1C1 style depending on the workspace setting.
7GeneralNumber format of the cell, as text (for example, "m/d/yy" or "General").
81Number indicating the cell's horizontal alignment:1 = General
90Number indicating the left-border style assigned to the cell:0 = No border
100Number indicating the right-border style assigned to the cell. See type_num 9 for descriptions of the numbers returned.
110Number indicating the top-border style assigned to the cell. See type_num 9 for descriptions of the numbers returned.
122Number indicating the bottom-border style assigned to the cell. See type_num 9 for descriptions of the numbers returned.
131Number from 0 to 18, indicating the pattern of the selected cell as displayed in the Patterns tab of the Format Cells dialog box, which appears when you choose the Cells command from the Format menu. If no pattern is selected, returns 0.
14TRUEIf the cell is locked, returns TRUE; otherwise, returns FALSE.
15FALSEIf the cell's formula is hidden, returns TRUE; otherwise, returns FALSE.
168.43A two-item horizontal array containing the width of the active cell and a logical value indicating whether the cell's width is set to change as the standard width changes (TRUE) or is a custom width (FALSE).
1713.5Row height of cell, in points.
18ArialName of font, as text.
1910Size of font, in points.
20FALSEIf all the characters in the cell, or only the first character, are bold, returns TRUE; otherwise, returns FALSE.
21FALSEIf all the characters in the cell, or only the first character, are italic, returns TRUE; otherwise, returns FALSE.
22FALSEIf all the characters in the cell, or only the first character, are underlined, returns TRUE; otherwise, returns FALSE.
23FALSEIf all the characters in the cell, or only the first character, are struck through, returns TRUE; otherwise, returns FALSE.
240Font color of the first character in the cell, as a number in the range 1 to 56. If font color is automatic, returns 0.
25FALSEIf all the characters in the cell, or only the first character, are outlined, returns TRUE; otherwise, returns FALSE. Outline font format is not supported by Microsoft Excel for Windows.
26FALSEIf all the characters in the cell, or only the first character, are shadowed, returns TRUE; otherwise, returns FALSE. Shadow font format is not supported by Microsoft Excel for Windows.
Sheet1
 
Upvote 0
Ok, I was able ot duplicate what you did.

How the heck does it work???

Is the info from the help file fror the Info worksheet function?
 
Upvote 0
Hi, Ahnold,

beautiful, but I can't get this to work, unable to translate to Dutch
GET.CELL ...

can you translate it?
or can you email your sheet ?

kind regards,
Erik
 
Upvote 0
Upvote 0
Ahnold,

Thank you for sending the workbook with a kind note attached :biggrin:
This is working within the "defined-name-formula", but I can't put this GET.CELL in a cell to get results. (popup: "this function is unvalid")Can you ?
Where does the text of column C come from ?
not here ? http://www.microsoft.com/downloads/results.aspx?freetext=xlmacr8.hlp&productID=&DisplayLang=en = the link you posted

kind regards,
Erik

PS
to avoid any confusion for future "readers"
you wrote
=5*10 .... =TwentyFive and 25 will be displayed

make it
"=5*5"
 
Upvote 0
erik.van.geit said:
This is working within the "defined-name-formula", but I can't put this GET.CELL in a cell to get results. (popup: "this function is unvalid")Can you ?
No, it won't work that way. I believe it will only work that way in Excel 4.0.
erik.van.geit said:
Where does the text of column C come from ?
not here ? http://www.microsoft.com/downloads/results.aspx?freetext=xlmacr8.hlp&productID=&DisplayLang=en = the link you posted
Might be a bad link. Try going to http://www.microsoft.com/downloads and search for xlmacr8.hlp.
erik.van.geit said:
PS
to avoid any confusion for future "readers"
you wrote
=5*10 .... =TwentyFive and 25 will be displayed

make it
"=5*5"
Fixed :oops:
 
Upvote 0

Forum statistics

Threads
1,215,398
Messages
6,124,694
Members
449,179
Latest member
kfhw720

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top