What does these two statements mean?

Phoenix_Turn

New Member
Joined
May 11, 2011
Messages
37
Hi all,

I am a newbie with computing and was wondering wat does these two statements in vba mean?:

intItem = shtProd.Range("F65336").End(xlUp).Row
intRow = shtStatement.Range("A65336").End(xlUp).Row + 1

where the left handside are integeres

and shtProd and shtStatement are worksheets.

Anyone care to explain?

Thanks
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
There are other ways of getting the last filled row than using the Range("F" & Rows.Count).End(xlUp).Row method but no way of getting to the end of column F other than Range("F" & Rows.Count).Select
 
Upvote 0
For the last filled row in column F

Code:
LR = Columns("F").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
For the last filled row in the entire sheet (where different columns may have different numbers of filled rows)

Code:
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
 
Upvote 0
For the last filled row in column F

Code:
LR = Columns("F").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
For the last filled row in the entire sheet (where different columns may have different numbers of filled rows)

Code:
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row

okily dokily!

Thank you! :)
 
Upvote 0
Btw ppl,

for:

intItem = shtProd.Range("F65336").End(xlUp).Row,

wat does the ".Row" do here? And how does it contribute to the whole code here?
 
Upvote 0
As you stated earlier,

intItem is an interger and therefore, can only hold an integer value

You stated shtProd is a worksheet

You know what Range("F65336") is - it's a cell reference

You had .End(xlUp) explain what it does, it finds the first none empty cell in column F that is lower in value than row 65336

The .Row part returns the number of the row it finds of the cell in column F that is above the (last) cell F65336 and sets intItem to this row number

I think looking at the questions you've been asking, you'd be advised to purchase a book on VBA programming or perhaps try using internet search to answer some of your questions. Maybe do a search in Amazon, I find the Dummies guide to VBA programming very useful:
http://www.amazon.co.uk/Excel-2007-...=sr_1_2?ie=UTF8&s=books&qid=1305480189&sr=8-2
 
Upvote 0
As you stated earlier,

intItem is an interger and therefore, can only hold an integer value

You stated shtProd is a worksheet

You know what Range("F65336") is - it's a cell reference

You had .End(xlUp) explain what it does, it finds the first none empty cell in column F that is lower in value than row 65336

The .Row part returns the number of the row it finds of the cell in column F that is above the (last) cell F65336 and sets intItem to this row number

I think looking at the questions you've been asking, you'd be advised to purchase a book on VBA programming or perhaps try using internet search to answer some of your questions. Maybe do a search in Amazon, I find the Dummies guide to VBA programming very useful:
http://www.amazon.co.uk/Excel-2007-...=sr_1_2?ie=UTF8&s=books&qid=1305480189&sr=8-2

thank you!! :)

So when u meant: first none empty cell in column F that is lower in value than row 65336

it is the first none empty cell at the top or is it the non empty cell and below it are all empty cells?

And what about this:

intRow = shtSummary.Range("A65336").End(xlUp).Row + 1

whats with the +1 here? :s
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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