Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
How do I change the column heading in Excel to display "A" "B" "C | New Users to Excel | |||
Procedure for changing default so "A" is in left-most column | Excel Discussion (Misc queries) | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
how do I "freeze" the left hand title column | Setting up and Configuration of Excel |