Challenge with a bit of VBA code to select a particular field

nicklbailey

New Member
Joined
Apr 10, 2013
Messages
3
Dear Everyone,

I am having trouble with a bit of VBA code, here is what I want to do:

Column1Column2Column3
ValueValue
ValueValue
ValueValue

<tbody>
</tbody>
I want to select all of the rows in the last column (which is blank) going down as far as the last row in the previous column that has data. In this example that would be the three cells with Xs below

Column1Column2Column3
ValueValue X
ValueValueX
ValueValueX

<tbody>
</tbody>


The column number of column32 and column33 are both variable as is the number of values in each, but column 3 is always one after column 2. I want the macro to run when the second row of Column3 is selected. This is my code

ActiveSheet.Range(Activecell & ActiveSheet.Range(ActiveCell.Offset(0, -1)).End(xlDown).Offset(0, 1).Address).Select

It consistently gives an error, and I am not sure why

Help would be appreciated
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi Nick. Your explanation is a little hard to follow. When you say
I want to select all of the rows in the last column (which is blank)
do you want to copy the entire row or just the cell? Also, I'm not sure what you mean by
The column number of column32 and column33 are both variable
Could you please be more specific using column letters rather than column numbers and perhaps an example of what you want the data to look like after the macro is run?
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

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