Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
Is there any way to put this in one statement? Dim FinalRow As Variant FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row -- mpeplow ------------------------------------------------------------------------ mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812 View this thread: http://www.excelforum.com/showthread...hreadid=562555 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
No. And declare it as Long, not Variant, you'll save memory and speed.
HTH. Best wishes Harald "mpeplow" skrev i melding ... Is there any way to put this in one statement? Dim FinalRow As Variant FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row -- mpeplow ------------------------------------------------------------------------ mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812 View this thread: http://www.excelforum.com/showthread...hreadid=562555 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
VBA doesn't support assignment as part of a declaration.
So no, not really. -- Tim Williams Palo Alto, CA "mpeplow" wrote in message ... Is there any way to put this in one statement? Dim FinalRow As Variant FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row -- mpeplow ------------------------------------------------------------------------ mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812 View this thread: http://www.excelforum.com/showthread...hreadid=562555 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
Well...<g
If you remove Option Explicit from your module then "FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row" will work and the Dim statement is not required. Of course, you will never want to let anybody see your code.<g -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "mpeplow" wrote in message Is there any way to put this in one statement? Dim FinalRow As Variant FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row -- mpeplow |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
Sort of but it's a REALLY BAD IDEA. So long as you do not have "Option
Explicit" at the top of the code module you are not required to declare your variables. VB will create varaibles on the fly for you. The variables created are of type Variant. So you could just write (without the dim statement). FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row When this line of code executes the compiler will create FinalRow for you as a variable of type variant. I can not stress this enough that doing this is an EXTREMELY BAD IDEA. DON'T DO IT. That being said it is possible. -- HTH... Jim Thomlinson "mpeplow" wrote: Is there any way to put this in one statement? Dim FinalRow As Variant FinalRow = ActiveSheet.Range("A65536").End(xlUp).Row -- mpeplow ------------------------------------------------------------------------ mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812 View this thread: http://www.excelforum.com/showthread...hreadid=562555 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
thanks everyone BTW: I remeber using Option Explicit way back when I was making VB6 six apps and it's in all of my code. but I have forgotton what it does? What does it do? I'm guessing to force you to declare your variables which is a good idea. And why is everyone so "ALL ABOUT" it. -- mpeplow ------------------------------------------------------------------------ mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812 View this thread: http://www.excelforum.com/showthread...hreadid=562555 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Declerations
You are exactly correct. Option Explicit forces you to declare all of your
variables. Not declaring variables is VERY VERY BAD programming... You can actually get VB(A) to automatically place option explicit at the top of every code module by choosing Tools - Options - Editor - Require Variable Declarations in the VBE. -- HTH... Jim Thomlinson "mpeplow" wrote: thanks everyone BTW: I remeber using Option Explicit way back when I was making VB6 six apps and it's in all of my code. but I have forgotton what it does? What does it do? I'm guessing to force you to declare your variables which is a good idea. And why is everyone so "ALL ABOUT" it. -- mpeplow ------------------------------------------------------------------------ mpeplow's Profile: http://www.excelforum.com/member.php...o&userid=34812 View this thread: http://www.excelforum.com/showthread...hreadid=562555 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Public Declerations | Excel Programming |