![]() |
Selecting single column with merged cell at top
Hello,
I'm having a bit of a problem in my macro with something that should be very simple. Namely, I'm trying to select a column. I need to insert a column at Column N. My script is as follows: Columns("N:N").Select Selection.Insert Shift:=xlToRight The problem appears to be that I have a cell (which contains a title) that is merged across several columns on my worksheet, in particular, Range("N:S"). So, whenever my macro runs, it always selects the whole Range("N:S") instead of just Column N. Does anyone know how I may work around this? When I do this manually, I can select Column N alone and not the whole range across which the topmost cell is merged. Any ideas greatly appreciated! -Paul ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Selecting single column with merged cell at top
Paul,
Use any cell that is below (or above) the merged cells Range("N5").EntireColumn.Insert -- sb "Paul Kendall" wrote in message ... Hello, I'm having a bit of a problem in my macro with something that should be very simple. Namely, I'm trying to select a column. I need to insert a column at Column N. My script is as follows: Columns("N:N").Select Selection.Insert Shift:=xlToRight The problem appears to be that I have a cell (which contains a title) that is merged across several columns on my worksheet, in particular, Range("N:S"). So, whenever my macro runs, it always selects the whole Range("N:S") instead of just Column N. Does anyone know how I may work around this? When I do this manually, I can select Column N alone and not the whole range across which the topmost cell is merged. Any ideas greatly appreciated! -Paul ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Selecting single column with merged cell at top
Thanks, Steve! Don't understand why I couldn't think of that simple work around. Best Regards, -Paul -- Paul Kendall ------------------------------------------------------------------------ Paul Kendall's Profile: http://www.excelforum.com/member.php...fo&userid=1526 View this thread: http://www.excelforum.com/showthread...hreadid=160713 |
Selecting single column with merged cell at top
Paul,
Because when we think of inserting columns - we think of selecting the entire column. Since I have run into this before, and because I insert/delete columns and rows so much - it is now second nature... Glad to share... -- sb "Paul Kendall" wrote in message ... Thanks, Steve! Don't understand why I couldn't think of that simple work around. Best Regards, -Paul -- Paul Kendall ------------------------------------------------------------------------ Paul Kendall's Profile: http://www.excelforum.com/member.php...fo&userid=1526 View this thread: http://www.excelforum.com/showthread...hreadid=160713 |
All times are GMT +1. The time now is 10:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com