Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
ben ben is offline
external usenet poster
 
Posts: 22
Default going 3 columns over in a macro

Hello,

I recorded a macro and have a small detail I need to fix, but am unsure how
to do it. At the end of the recording of the macro, I hit the right arrow 3
times to move over 3 cells across. The problem is that the macro recorded it
as follows: Range("F834").Select

How do I change that line from an absolute reference to a relative one so
that the cell I am on is 3 to the right?

Thanks,
Ben
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 15,768
Default going 3 columns over in a macro

Try replacing this:

Range("F834").Select

With this:

ActiveCell.Offset(0, 3).Select

Whatever cell you're in when the macro runs will determine where you end up.
If you're in A1 you'll end up in D1.

--
Biff
Microsoft Excel MVP


"ben" wrote in message
...
Hello,

I recorded a macro and have a small detail I need to fix, but am unsure
how to do it. At the end of the recording of the macro, I hit the right
arrow 3 times to move over 3 cells across. The problem is that the macro
recorded it as follows: Range("F834").Select

How do I change that line from an absolute reference to a relative one so
that the cell I am on is 3 to the right?

Thanks,
Ben



  #4   Report Post  
Posted to microsoft.public.excel.newusers
ben ben is offline
external usenet poster
 
Posts: 22
Default going 3 columns over in a macro

Don Guillett wrote:
As always, post your code for comments. It's almost always NOT necessary
to select a cell.


I don't know what you mean since this would depend on what the user (me)
wants to do. After highlighting the data in one excel file, I do a special
paste with just the values of the highlighted region in another sheet (in
another file) where the cell it finishes up on is 3 to the right of the
paste so I can manually enter into that column data. I wanted this done
through a macro, so I recorded one which worked fine except for which cell
it ended up on which was not 3 to the right but ended up on the cell I ended
with when recording the macro.
  #6   Report Post  
Posted to microsoft.public.excel.newusers
ben ben is offline
external usenet poster
 
Posts: 22
Default going 3 columns over in a macro

No problem. I'll certainly do that in the future.

Don Guillett wrote:

Then Biff gave you a solution. You could have also used OFFSET. I repeat
that you should always post your code for comments and improvement
suggestions.

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
Macro lookup columns Martincito23 Excel Discussion (Misc queries) 2 January 26th 07 05:42 PM
Need a macro to hide certain columns Dallman Ross Excel Discussion (Misc queries) 12 October 19th 06 05:58 PM
insert columns macro is putting 2 columns instead of 1 AGH Excel Worksheet Functions 2 February 27th 06 02:36 PM
macro to unmerge columns HankY Excel Discussion (Misc queries) 2 December 8th 05 06:04 AM
Macro for resizing of columns? MatthewTap Excel Discussion (Misc queries) 2 December 1st 05 06:48 PM


All times are GMT +1. The time now is 08:18 AM.

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"