Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Add column to left of "hotspot"

I have read the previous threads and can now add a column to the right (or left) of the current active cell using

Sub AddColumnToTheLeft()
ActiveCell.Offset(0, 1).EntireColumn.Insert
End Sub

However, I need to write code that will add a column to the left of a "hotspot" graphic I have fixed to what is currently Column J. The idea is for the user to click on the yellow block and get a new blank column immediately to its left.

Obviously, each time I create a new column, the hotspot will move to Column K, L... etc. and the new column is always required to be the last (or right-hand) one of the series immediately before this hotspot

Therefore the macro I tried to record is also no use because it simply goes back to Column J each time and puts the new column to the left of that instead of to the left of the hotspot just clicked on

Please tell me what should come instead of "ActiveCell.Offset(0, 1)." to make this work €” I assume this IS the bit I need to change

Thanks in advance

teaba



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add column to left of "hotspot"

If you assign this macro to the graphic, it should work
Sub AddColumnToLeftOfHotSpot()
set rng = activesheet.shapes(Application.Caller).TopLeftCell
rng.EntireColumn.Insert
End Sub

--
Regards,
Tom Ogilvy


"teabag" wrote in message
...
I have read the previous threads and can now add a column to the right (or

left) of the current active cell using:

Sub AddColumnToTheLeft()
ActiveCell.Offset(0, 1).EntireColumn.Insert
End Sub

However, I need to write code that will add a column to the left of a

"hotspot" graphic I have fixed to what is currently Column J. The idea is
for the user to click on the yellow block and get a new blank column
immediately to its left.

Obviously, each time I create a new column, the hotspot will move to

Column K, L... etc. and the new column is always required to be the last (or
right-hand) one of the series immediately before this hotspot.

Therefore the macro I tried to record is also no use because it simply

goes back to Column J each time and puts the new column to the left of that
instead of to the left of the hotspot just clicked on!

Please tell me what should come instead of "ActiveCell.Offset(0, 1)." to

make this work - I assume this IS the bit I need to change!

Thanks in advance,

teabag






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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I change the column heading in Excel to display "A" "B" "C Thai New Users to Excel 1 November 30th 07 08:06 PM
Procedure for changing default so "A" is in left-most column Rivkah Excel Discussion (Misc queries) 2 November 3rd 07 04:43 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
how do I "freeze" the left hand title column DDAANN Setting up and Configuration of Excel 4 February 26th 06 12:21 PM


All times are GMT +1. The time now is 02:53 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"