Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show all, but leave the cursor where it is
I used the macro below to hide columns, but want to add code that says
unhide all columns and leave the cursor where it is before the below code is run. How would I add that into this macro? (I don't want to use 'custom view' because the cursor is left exactly where the view was saved) Dim arr As Variant Dim i As Long arr = Array("d:d", "f:f", "h:h", "j:j") For i = LBound(arr) To UBound(arr) Columns(arr(i)).EntireColumn.Hidden = True Next |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show all, but leave the cursor where it is
I ran this code with the cursor in G3. It stayed in G3 during the hide and
unhide process. Sub hidn() Dim arr As Variant Dim i As Long arr = Array("d:d", "f:f", "h:h", "j:j") For i = LBound(arr) To UBound(arr) Columns(arr(i)).EntireColumn.Hidden = True Next 'MsgBox "Check" 'For testing only For i = LBound(arr) To UBound(arr) Columns(arr(i)).EntireColumn.Hidden = False Next End Sub "Annette" wrote: I used the macro below to hide columns, but want to add code that says unhide all columns and leave the cursor where it is before the below code is run. How would I add that into this macro? (I don't want to use 'custom view' because the cursor is left exactly where the view was saved) Dim arr As Variant Dim i As Long arr = Array("d:d", "f:f", "h:h", "j:j") For i = LBound(arr) To UBound(arr) Columns(arr(i)).EntireColumn.Hidden = True Next |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show all, but leave the cursor where it is
In case you have more that the three columns you want to unhide.
Sub hidn() Dim arr As Variant Dim i As Long arr = Array("d:d", "f:f", "h:h", "j:j") For i = LBound(arr) To UBound(arr) Columns(arr(i)).EntireColumn.Hidden = True Next 'MsgBox "Check" 'For testing only For Each c In Sheets(1).Columns If c.Hidden = True Then c.Hidden = False End If Next End Sub "Annette" wrote: I used the macro below to hide columns, but want to add code that says unhide all columns and leave the cursor where it is before the below code is run. How would I add that into this macro? (I don't want to use 'custom view' because the cursor is left exactly where the view was saved) Dim arr As Variant Dim i As Long arr = Array("d:d", "f:f", "h:h", "j:j") For i = LBound(arr) To UBound(arr) Columns(arr(i)).EntireColumn.Hidden = True Next |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
HOW DO I GET THE CURSOR TO SHOW UP | Setting up and Configuration of Excel | |||
Leave live cursor in a cell? | Excel Programming | |||
Do not show lack of data as a zero on graph lines, leave blank | Charts and Charting in Excel | |||
getting the cursor to show in a textbox | Excel Programming | |||
Show user form, leave wosksheet active | Excel Programming |