static number to cell reference

Bandito1

Board Regular
Joined
Oct 18, 2018
Messages
239
Office Version
  1. 2016
Platform
  1. Windows
Hello all,

Im using the code below to show or hide a label when the caption of some other label is 145;
the lblDisplaying is used to display how many search results are found. When i don't search on any search term there are 145 search terms and i don't want to display the label then.

Code:
If lblSearchResults.Caption = "145" Then
               lblDisplaying.Visible = False

I would like to change this cause the number 145 is variable. Data is added and removed so that number isn't always 145.

I changed it in;

Code:
If lblSearchResults.Caption = Shifts_List!C38 Then
               lblDisplaying.Visible = False

In cell C38 is the max number of data that can be searched.

The above code doesn't work, can someone tell me what i do wrong?
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Code:
... = Range("Shifts_List!C38").Text
 
Last edited:
Upvote 0
Or
... = Sheets("Shifts_List").Range(C38)
or
... = Sheets("Shifts_List").[C38]
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,594
Members
452,655
Latest member
goranzoric

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