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

I'm currently writing a macro where I'm trying to copy the activated cell
plus the 10 to the right but it just keeps activating the cell 10 over to the
right not the entire row.

This is what I'm writing

Worksheets("DATA").Activate
Cells.Find(What:="Name",After:=ActiveCell,LookIn:= xlFormulas, LookAt:=xlPart,
SearchOrder:=xl, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:
=False).Activate
ActiveCell.Offset(RowOffset:=0, ColumnOffset:=10).Activate

Could someone tell me why it's not working? Thanks

MartÃ*n Hinojosa

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Offset issue

Several Options here Martin:
Range(ActiveCell,ActiveCell.Offset(,10)).Copy

ActiveCell.Resize(1,11).Copy

I prefer to not select cells at all as this slows stuff down:
Dim R As Range
Set R = Cells.Find(BlahBlahBlah)
If R Is Nothing Then
'Not Found Spawn Error Message
End If
R.Resize(1,11).Copy
This solution has the added bonus of error trapping when the search text is
not found whereas Cells.Find().Activate will error out when the search does
not find anything.
--
Charles Chickering

"A good example is twice the value of good advice."


"Hinojosa via OfficeKB.com" wrote:

I'm currently writing a macro where I'm trying to copy the activated cell
plus the 10 to the right but it just keeps activating the cell 10 over to the
right not the entire row.

This is what I'm writing

Worksheets("DATA").Activate
Cells.Find(What:="Name",After:=ActiveCell,LookIn:= xlFormulas, LookAt:=xlPart,
SearchOrder:=xl, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:
=False).Activate
ActiveCell.Offset(RowOffset:=0, ColumnOffset:=10).Activate

Could someone tell me why it's not working? Thanks

MartÃ*n Hinojosa

--
Message posted via http://www.officekb.com


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Offset issue

This is a little clumsy, but it works. For the last line use:

call range(activecell, activecell.Offset(0,10)).Select



Hope this helps,
dom



Hinojosa via OfficeKB.com wrote:
I'm currently writing a macro where I'm trying to copy the activated cell
plus the 10 to the right but it just keeps activating the cell 10 over to the
right not the entire row.

This is what I'm writing

Worksheets("DATA").Activate
Cells.Find(What:="Name",After:=ActiveCell,LookIn:= xlFormulas, LookAt:=xlPart,
SearchOrder:=xl, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:
=False).Activate
ActiveCell.Offset(RowOffset:=0, ColumnOffset:=10).Activate

Could someone tell me why it's not working? Thanks

Martín Hinojosa

--
Message posted via http://www.officekb.com


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
Cell offset issue MGarrison Excel Worksheet Functions 3 July 31st 08 03:52 PM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Offset issue? BigWave@AC Excel Programming 4 August 3rd 06 05:51 PM
Problem with Range.Cells.Offset and Range.Cells( row + offset, column) [email protected] Excel Programming 2 August 22nd 05 05:25 AM
Max Offset Voodoodan Excel Discussion (Misc queries) 19 May 26th 05 11:47 AM


All times are GMT +1. The time now is 02:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"