cell value based on hidden and un-hidden rows

lawrebw

New Member
Joined
Feb 7, 2019
Messages
4
I have code that will give a specific cell value based on if a row is hidden or not

If Worksheets("Sheet3").Rows("10").EntireRow.Hidden = True Then
Worksheets("Sheet3").Range("F8").Value = "Underwriting File View Off"
End If
If Worksheets("Sheet3").Rows("10").EntireRow.Hidden = False Then
Worksheets("Sheet3").Range("F8").Value = "Underwriting File View On"
End If

The code works, however the rows are hidden/unhidden based on a Command Button. The cell value does not change until click or tab to a different cell on the sheet. I'd like it to change as soon as I click on the command button without having to click onto a different cell. Are there any suggestions on how I could do this better?

Thanks!
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Jeffrey Mahoney

Well-known Member
Joined
May 31, 2015
Messages
1,768
It sounds like you have the the code in a SHEET level module and it runs when you select a different cell. You need to copy that code into the Command Button code.

I wouldn't have that code to run each time you select a different cell. It bogs down the system.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,349
Messages
5,528,188
Members
409,807
Latest member
nicky736

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top