LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 227
Default Insert Row Macro with Hidden Columns

Hi Steven

Try...

Sub test()
ActiveCell.EntireRow.Copy
ActiveCell.EntireRow.Insert Shift:=xlDown

'The following is one line if the text wraps
Application.Intersect(ActiveCell.EntireRow.Offset( 1, 0),
Range("B:E,M:W,Y:Y")).ClearContents

End Sub
--


XL2003
Regards

William



"steven_thomas"
wrote in message
news:steven_thomas.1w0z2k_1127837133.014@excelforu m-nospam.com...

I wrote a macro for users to insert a row below with some (not all)
copied cell formulas from above ... the user has to highlight any cell
in the row above where they want the insert and then press a button
that I have assiciated to the macro ... my macro works except when I
have hidden columns (which I do to keep the view simple) ...

I could add a section to pre unhide columns (and then rehide to keep
the view) but I will then lose my active cell pointer (I use this to
make sure I insert the row in the right place) ... any ideas ??? ... I
thought I could create a field to hold the activecell reference and
then go back to it once I unhide the columns but have been unable to
figure out how to do this ... the other answer is to understand why the
hidden columns are creating a problem ...

Here is the code I was referencing ...

Private Sub InsertRisk_Click()
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False

ActiveCell.Range("b1:e1").Select
Selection.ClearContents
ActiveCell.Offset(0, -1).Range("A1").Select

ActiveCell.Range("m1:w1").Select
Selection.ClearContents
ActiveCell.Offset(0, -12).Range("A1").Select

ActiveCell.Range("y1:y1").Select
Selection.ClearContents
ActiveCell.Offset(0, -24).Range("A1").Select

End Sub


Thanks in advance


--
steven_thomas
------------------------------------------------------------------------
steven_thomas's Profile:
http://www.excelforum.com/member.php...o&userid=27568
View this thread: http://www.excelforum.com/showthread...hreadid=471122




 
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
can no longer insert new columns & unhide hidden columns em2 Excel Worksheet Functions 1 July 19th 07 03:18 AM
Macro that will hidden columns, rows and worksheets based on an identifier [email protected] Excel Discussion (Misc queries) 2 November 27th 06 03:49 PM
Protect hidden rows/columns -macro help ttbbgg Excel Discussion (Misc queries) 4 October 25th 06 04:20 PM
insert columns macro is putting 2 columns instead of 1 AGH Excel Worksheet Functions 2 February 27th 06 02:36 PM
macro to insert row, copy cells and keep hidden columns steven_thomas Excel Programming 0 September 26th 05 09:40 PM


All times are GMT +1. The time now is 11:38 PM.

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

About Us

"It's about Microsoft Excel"