vba to offset range

cjcass

Well-known Member
Joined
Oct 27, 2011
Messages
679
Office Version
  1. 2016
Platform
  1. Windows
Hi,
I have the code below that finds a cell, offsets and copies the range 100 cells below, how do I change the offset to get it to also select the column to the right so it's copying 100 rows down and 2 columns?
Many thanks.
VBA Code:
Dim rFound As Range
   
    Set rFound = Sheet6.Rows(210).Find(What:=Sheet1.Range("E2").Value, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
    If Not rFound Is Nothing Then
   
    rFound.Offset(2, 0).Resize(100).Copy
       
    End If
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Ok, I played about and found what appears to be a simple solution.
VBA Code:
Sheet6.Rows(210).Find(What:=Sheet1.Range("E2").Value, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False).Activate
    
Range(ActiveCell.Offset(2, 0), ActiveCell.Offset(100, 1)).Select
    
Selection.Copy
 
Upvote 0
2 rows down from the found cell, copy 100 rows x 2 columns:
VBA Code:
rFound.Offset(2, 0).Resize(100, 2).Copy
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top