Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88854

Referencing cell properties [closed]

$
0
0

In VBA, one can see all of the objects attached to a cell, such as AddIndent, AllowEdit, ColumnWidth, ID, etc. I need to attach data to a cell and optionally choose to make it visible. For example, through VBA I can set the cell properties, like this:

Worksheets("sheet1").Cells(1,1).ID = "TomS"
Worksheets("sheet1").Cells(1,1).Value = "Vacation"

Once these objects are set within my VBA script, they never change values but I need to switch which one is visible to the user. I would like to have another cell that controls this switch, say cell A1 can contain "ID" or "Value" to determine the cell content. By default, the cell will show "Vacation". I have users that are not VBA literate, so I want to change the property that is visible within a cell at an Excel level. How can I make the ID "TomS" become visible within the cell instead of the value of "Vacation"?


Viewing all articles
Browse latest Browse all 88854


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>