Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have a macro which adds a new row above the current row and using relative offset copies appropriate formulae and formatting. Its success relies on starting from column A How can I ensure the selected cell moves to column A before i run the rest of the code Thanks for your help -- richardlups ------------------------------------------------------------------------ richardlups's Profile: http://www.excelforum.com/member.php...o&userid=24946 View this thread: http://www.excelforum.com/showthread...hreadid=384820 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Good morning Richardlups Not sure if you want to start from the whole of column A being selected or just a single cell in column A being selected. I would suspect the latter, so the line to use is as simple as: Range("A1").Select (but if you need to select the whole of column A use: Columns("A:A").Select). HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=384820 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks for that Unfortunately this takes me to cell A1 which is no good for the late positioning see code below The purpose is to be able to add a new row anywhere in the worksheet but I cant rely on the user to start from column A, just the row belo where they want the new line. ActiveSheet.Unprotect Selection.EntireRow.Insert ActiveCell.Offset(-1, 5).Range("A1").Select Selection.Copy ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(-1, 3).Range("A1").Select Application.CutCopyMode = False Selection.Copy ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(-1, 2).Range("A1").Select Application.CutCopyMode = False Selection.Copy ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(1, 0).Range("A1").Select ActiveSheet.Paste Application.CutCopyMode = False ActiveCell.Offset(0, -10).Range("A1").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True Scenarios:=Tru -- richardlup ----------------------------------------------------------------------- richardlups's Profile: http://www.excelforum.com/member.php...fo&userid=2494 View this thread: http://www.excelforum.com/showthread.php?threadid=38482 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Richardlups So if I understand you right, the user could be in, say, G81 and click on your macro to add a row, but the macro needs to be started from column A (ie A81). The two lines below will make the activecell of any current row in column A. num = (ActiveCell.Columns(ActiveCell.Columns.Count).Colu mn - 1) * -1 ActiveCell.Offset(columnOffset:=num).Activate HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=384820 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanks folks I have an answer now .. -- richardlup ----------------------------------------------------------------------- richardlups's Profile: http://www.excelforum.com/member.php...fo&userid=2494 View this thread: http://www.excelforum.com/showthread.php?threadid=38482 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return column number from column header text | Excel Discussion (Misc queries) | |||
Return text in Column A if Column B and Column K match | Excel Worksheet Functions | |||
Find max value in one column and return the value of corrosponding cell in different column | Excel Worksheet Functions | |||
LOOKUP and return the column heading for IF/THEN return for False | Excel Discussion (Misc queries) | |||
Excel - Return column alphabet from column number | Excel Programming |