VB for hidden columns, trying to get this working

moncode

New Member
Joined
Dec 14, 2016
Messages
8
Hi, I'm trying to get this VB working for hidden columns, it's working for rows (got it somewhere searching in google ) .... I'm not good at this ....


Sub Test1()
Dim x As Long, y As Long
x = ActiveCell.Row
y = ActiveCell.Column
Do
x = x + 1
Loop Until Cells(x, y).EntireRow.Hidden = False
Cells(x, y).Select
End Sub<strike></strike>
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
moncode,

Not sure what you are wanting to achieve here but the column variant of the above code would be...

Code:
Sub Test2()
Dim x As Long, y As Long
x = ActiveCell.Row
y = ActiveCell.Column
Do
y = y + 1
Loop Until Cells(x, y).EntireColumn.Hidden = False
Cells(x, y).Select
End Sub

Hope that helps.
 
Upvote 0
Thank you for your response but it's not doing what I'm looking for.

Here's an example of my situation : A1 and B1 are merge with a text in it (let's say "Hello mom") then column "C" is hidden I need a VB code that will let me go to D1 and E1 that are also merge to write something down in these merge cell without stopping in C1.

I've tried Offset function but it doesn't ignore the hidden cells

Also I need to do that in several places in the spreadsheet and it's not always in the same place.
 
Last edited:
Upvote 0
Try...

Code:
Sub Test3()
Dim y As Long
Set AC = ActiveCell


Do
    y = y + 1
    AC.Offset(0, y).Select
Loop Until AC.Offset(0, y).EntireColumn.Hidden = False


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

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