Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Return to column A


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Return to column A


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Return to column A


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Return to column A


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Return to column A


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
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
Return column number from column header text Roger[_3_] Excel Discussion (Misc queries) 4 February 14th 08 09:40 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
Find max value in one column and return the value of corrosponding cell in different column [email protected] Excel Worksheet Functions 5 October 16th 07 12:33 PM
LOOKUP and return the column heading for IF/THEN return for False NN Excel Discussion (Misc queries) 1 October 6th 06 11:24 AM
Excel - Return column alphabet from column number Sathyaish Excel Programming 2 April 7th 04 02:40 PM


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