FINDING INFO IN HIDDEN CELLS

Fire_Chief

Well-known Member
Joined
Jun 21, 2003
Messages
693
Office Version
  1. 365
Platform
  1. Windows
I am trying to find info in a group of cells that are hidden.
It will give be an error message unless I unhide the cells.
THIS WORKS FIND:
Columns("LV:MK").Select
Selection.EntireColumn.Hidden = False

Range("LV399:MK452").Select
Selection.Find(What:=DIVISION, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

THIS WILL NOT WORK:

Range("LV399:MK452").Select
Selection.Find(What:=Division, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate

I have done this in another park of the workbook (same page) without unhide it, and it works so I am confused.
I have also unlocked the entire workbook with no luck.
Tried forever to figure this out. Need help..


error message is:
Object variable or with block variable not set


Thank You
 
Last edited by a moderator:
Hmmm, I see what you mean. I have not come across this before (mostly because I am never really searching hidden ranges).
I found this thread which seems to talk about the problem and potential workarounds: Perform a find on hidden cells
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I think I fixed it.



Thank You
Can you post what your solution was?
Besides me being curious, it might also help people who stumble upon this thread in the future.
 
Upvote 0
Here is my code:

For T = 1 To 4
If T = 1 Then
AREA = "FP9" 'UNHIDDEN
AREA2 = "LX399" 'HIDDEN
ElseIf T = 2 Then
AREA = "FP12"
AREA2 = "LX424"
ElseIf T = 3 Then
AREA = "FR9"
AREA2 = "MH399"
ElseIf T = 4 Then
AREA = "FR12"
AREA2 = "MH424"
End If

If Range(AREA).Value = "SOUTH" Then
Range(AREA2).Value = "SOUTH"
ElseIf Range(AREA).Value = "MIDWEST" Then
Range(AREA2).Value = "MIDWEST"
ElseIf Range(AREA).Value = "EAST" Then
Range(AREA2).Value = "EAST"
ElseIf Range(AREA).Value = "WEST" Then
Range(AREA2).Value = "WEST"
End If
Next T

Excel Formula:

Hope you can understand my code. I am self taught. If not ask and I will explain.
 
Upvote 0
So then, you are just copying the hidden Region value to some unhidden cells?
Is that right?

By the way, I think you can simply replace this whole part:
VBA Code:
If Range(AREA).Value = "SOUTH" Then
    Range(AREA2).Value = "SOUTH"
ElseIf Range(AREA).Value = "MIDWEST" Then
    Range(AREA2).Value = "MIDWEST"
ElseIf Range(AREA).Value = "EAST" Then
    Range(AREA2).Value = "EAST"
ElseIf Range(AREA).Value = "WEST" Then
    Range(AREA2).Value = "WEST"
End If
with just this:
VBA Code:
Range(AREA2).Value = Range(AREA).Value
 
Upvote 1
That might work but it may put in the reference again (=FP9). I am going to leave it as is.
It was tough figuring out what was wrong so I'm just glad to have it working.

I thank you for your input
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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