Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW DO I GET THE CURSOR TO SHOW UP austin63 Setting up and Configuration of Excel 1 January 13th 09 06:56 PM
Leave live cursor in a cell? [email protected] Excel Programming 2 June 4th 06 01:56 PM
Do not show lack of data as a zero on graph lines, leave blank Just Joe Charts and Charting in Excel 1 February 15th 06 08:12 PM
getting the cursor to show in a textbox Simon Lloyd[_495_] Excel Programming 2 June 21st 04 06:59 PM
Show user form, leave wosksheet active Wric Smith Excel Programming 3 December 4th 03 08:46 PM


All times are GMT +1. The time now is 08:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"