Could somebody check over this code please?

richanor

Active Member
Joined
Apr 8, 2006
Messages
291
Hi I am trying to define a range (called "Responses") of columns CJ:CU of a given row number. The code I'm using to locate the required row is here:

Code:
    Set ws = Worksheets("Database")
    Search = Me.PtNumber.Value
    SearchColumn = "A"
    Set Foundcell = ws.Columns(SearchColumn).Find(Search, LookIn:=xlValues, lookat:=xlWhole)

I am then trying to offset and resize the range using this:

Code:
Set Responses = Foundcell.Resize(0, 12).Offset(0, 87)

which gives me an "application defined or object defined error"

If you don't mind could you explain what I'm doing wrong as I'm trying to learn as I go.

Many thanks

Rich
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You can't have 0 as a resize dimension. For a single row use 1, to keep the original number of rows leave the first field empty.
 
Upvote 0
Brillian - thanks Jason! It makes sense now that you say it - really appreciate the explanation! (and working fine now)

Rich
 
Upvote 0

Forum statistics

Threads
1,215,777
Messages
6,126,838
Members
449,343
Latest member
DEWS2031

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