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
 
VoG has already explained to you that 65336 is the very last row. If it's the very last row, there can't be a row that is after that. So I don't understand why you are asking if there are cells below it.

In other words, what is lower than 65536? Yes 65535, 65534, 65532, etc. The last cell in column F LESS THAN 65536 that has a value in it. Click on cell F65536, then press CTRL+UP; what ever cell is then selected THIS IS THE CELL THAT it refers to. To confirm to yourself, write down 65536, then write down the cell you come to after pressing CTRL+UP and write down the row number of that cell. Then compare the two numbers and decide which one is larger and which number is smaller.

I've just explained to you that the .Row part returns an integer to the variable - do you know what an integer is? If you know what an integer is, what do you think "+1" to it will do? It will increase the value of that integer by 1. i.e. it is integer value +1 passed to your variable. In other words it is finding the NEXT row after the VERY last cell that has a value it in, in column F.

Try to thoroughly read the answers that are given to the questions you are asking and understand them before you ask your next question.
The questions you are asking are implying you're not reading the answers properly.
Write things down or draw diagrams, anything that makes you understand.
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
VoG has already explained to you that 65336 is the very last row. If it's the very last row, there can't be a row that is after that. So I don't understand why you are asking if there are cells below it.

In other words, what is lower than 65536? Yes 65535, 65534, 65532, etc. The last cell in column F LESS THAN 65536 that has a value in it. Click on cell F65536, then press CTRL+UP; what ever cell is then selected THIS IS THE CELL THAT it refers to. To confirm to yourself, write down 65536, then write down the cell you come to after pressing CTRL+UP and write down the row number of that cell. Then compare the two numbers and decide which one is larger and which number is smaller.

I've just explained to you that the .Row part returns an integer to the variable - do you know what an integer is? If you know what an integer is, what do you think "+1" to it will do? It will increase the value of that integer by 1. i.e. it is integer value +1 passed to your variable. In other words it is finding the NEXT row after the VERY last cell that has a value it in, in column F.

Try to thoroughly read the answers that are given to the questions you are asking and understand them before you ask your next question.
The questions you are asking are implying you're not reading the answers properly.
Write things down or draw diagrams, anything that makes you understand.

Thank you for that - I don't think I would have had the patience ;)

Phoenix Turn - take a look at Hiker's list http://www.mrexcel.com/forum/showpost.php?p=2676997&postcount=5
 
Upvote 0
Anytime VoG, going to bite my tongue less I say anything more!
 
Upvote 0
As far as the code it looks fine. I would ask, is it not performing as it should? That's a big difference versus you just want it shorter or written in a different way. If you don't understand the full code you have now, are you going to understand the code better if it is crafted in a different format? Code is very interesting in the fact, not everybody does it the same. Doesn't necessarily mean one is better than the other, just different.

With that being said, based on the comments in this thread, I see you didn't give full credence to the posted comments. Peter and Jack are much more knowledgeable about code than I so I would listen to what they have to say and heed/absorb.

Where is the person who wrote this code, are they not around to ask what they have done?

One of the tools you should consider is Smart Indenter. This will help make your code much more readable.

The best way to understand your code is by stepping through it by using the F8 key. Debugging VBA

Open the Excel file which contains this code >> open the VBE >> Alt + F11 >> then select the macro >> press F8 and this will launch the code into the Step Into mode. As you step through by continuing to press F8, the code will advance line by line. Once the line of code has passed a variable, hover your cursor over the variable and you will see the value which is being stored in the variable.

Also, take a look at the link Peter posted and consider getting a VBA book as Jack suggested.

The part where the code is copying and pasting could be cleaned up. Using select in your code can often slow it down. See here for instructions on how to do it.

Here’s an example:

Code:
Sub Macro1()
    Range("A1").Select
    Selection.Copy
    Range("A2").Select
    ActiveSheet.Paste
End Sub

The code above can be rewritten as:

Code:
 Range("A1").Copy Destination:=Range("A2")

Finally, please keep all discussions to the public forum. There are many more people out there trying to learn and any advice given will be better served on the open forum. Let’s face it, I am still learning and learn something new on this forum every day. If all those conversation took place through PM’s so much would be lost.

The code you sent me on PM will only be seen by one set of eyes, mine, but on the forum, that same code will be seen by numerous people who only want to help. Remember we all spend our own time on this forum because we love Excel and many who do it much better than I. :biggrin:
 
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