ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving around cell by cell in VBA? (https://www.excelbanter.com/excel-programming/359364-moving-around-cell-cell-vba.html)

drucey[_24_]

Moving around cell by cell in VBA?
 

Lovely people,

I'm having trouble using VBA to move activecell.

For example, i'm using a search macro to find a keyword on m
worksheet, and then i want it to:

Activecell to go down 4 rows, and right 1 column. (ie. from A41 to B4
(but can't use cells as they will change))
Select an area 24 rows down, and 2 columns across (ie. B45:C69) an
copy it onto the clip board.

I think i could do the rest now..

Any help would be very appreciated, thank you

--
druce
-----------------------------------------------------------------------
drucey's Profile: http://www.excelforum.com/member.php...fo&userid=3255
View this thread: http://www.excelforum.com/showthread.php?threadid=53449


Toppers

Moving around cell by cell in VBA?
 
Given FIND ia at activecell:

Dim rng as range
Set rng = ActiveCell.Offset(4, 1).Resize(24, 2)
MsgBox rng.Address
Rng.copy .....

24 rows, 2 columns from B45 will be B45:C68 not B45:C69

HTH

"drucey" wrote:


Lovely people,

I'm having trouble using VBA to move activecell.

For example, i'm using a search macro to find a keyword on my
worksheet, and then i want it to:

Activecell to go down 4 rows, and right 1 column. (ie. from A41 to B45
(but can't use cells as they will change))
Select an area 24 rows down, and 2 columns across (ie. B45:C69) and
copy it onto the clip board.

I think i could do the rest now..

Any help would be very appreciated, thank you!


--
drucey
------------------------------------------------------------------------
drucey's Profile: http://www.excelforum.com/member.php...o&userid=32553
View this thread: http://www.excelforum.com/showthread...hreadid=534493



drucey[_26_]

Moving around cell by cell in VBA?
 

Ah, figured out the moving around bit - ActiveCell.Offset(4,1).Select
:)

i'm so pleased with myself

Now just the selecting ...


--
drucey
------------------------------------------------------------------------
drucey's Profile: http://www.excelforum.com/member.php...o&userid=32553
View this thread: http://www.excelforum.com/showthread...hreadid=534493


drucey[_25_]

Moving around cell by cell in VBA?
 

Amazing! Thank you so much


--
drucey
------------------------------------------------------------------------
drucey's Profile: http://www.excelforum.com/member.php...o&userid=32553
View this thread: http://www.excelforum.com/showthread...hreadid=534493


Toppers

Moving around cell by cell in VBA?
 
Glad you've worked it out (the best learning)... but avoid using SELECTS if
you can as they are inefficient!

"drucey" wrote:


Ah, figured out the moving around bit - ActiveCell.Offset(4,1).Select
:)

i'm so pleased with myself

Now just the selecting ...


--
drucey
------------------------------------------------------------------------
drucey's Profile: http://www.excelforum.com/member.php...o&userid=32553
View this thread: http://www.excelforum.com/showthread...hreadid=534493




All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com