how to make this work - Range(Cells(6, TotalAmount), Cells(330, TotalAmount).End(xlUp))

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,881
Office Version
  1. 2010
Platform
  1. Windows
I'm trying to set a range using the following code:

Set rng1 = Range(Cells(6, TotalAmount), Cells(330, TotalAmount).End(xlUp))

It didn't work. It selected the range $P$4:$P$6 while p7 to p16 are not empty. What I want is a range starting from p6 down to before the first empty cell.

I tried the following code, it did not work either.

Set rng1 = Range(Cells(6, TotalAmount), [Cells(330, TotalAmount)].End(xlUp))

neither did this code:

Set rng1 = Range(Cells(6, TotalAmount), [Cells(330, TotalAmount).address].End(xlUp))


Any suggestion?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
It is not clear what you want to do.
in cells(j,k) this is the cell in the intersection of Jth row and kth column
in your case what is "total amount". your cells difiniltion will give intersection of 6th row and column number equal to 'total amount"

so explain with one or two examples
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,308
Members
452,904
Latest member
CodeMasterX

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