variables out of cell values

sulley333

Board Regular
Joined
Apr 29, 2010
Messages
71
Hi Everyone!

I have a list of cells...let's say H13:P13. They may or may not always be filled. The data is coming from selections in a list box. I would like to take whatever of the cells are populated and create variables out of them.

So, if H13 is populated than it would be call Caption1 and if I13 is populated it would be Caption2...any help on how I would code that?

This sounds so simple but I am having a tough time knowing where to start. It feels like if cell <> "" then caption1 = cell.

Thanks!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Oh...and this may help...what I am really trying to do with those values is filter them in a pivot table. What is hard with that is you really have to hard code something. Right now I have the following code when I know what the variables are:

Code:
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Brand")
    .PivotItems(brand_one).Visible = True
    For Each pi In .PivotItems
    Select Case UCase(pi.Name)
         Case UCase(brand_one), UCase(brand_two)
            pi.Visible = True
         Case Else
            pi.Visible = False
      End Select
    Next pi
    End With
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,761
Members
452,940
Latest member
rootytrip

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