ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DIM is what i am (https://www.excelbanter.com/excel-programming/286807-dim-what-i-am.html)

mushy_peas[_4_]

DIM is what i am
 
Say i have

Dim Current
Dim Last

and i had a cell with a number, how do i set Current to be equal tha
that value. isnt it:-

Current = Range("H1")

or am i just being a noob

Thank

--
Message posted from http://www.ExcelForum.com


Niek Otten

DIM is what i am
 
If your "H1" is on the ActiveSheet, yes. But it's always better to
explicitly indicate which sheet.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"mushy_peas " wrote in message
...
Say i have

Dim Current
Dim Last

and i had a cell with a number, how do i set Current to be equal that
that value. isnt it:-

Current = Range("H1")

or am i just being a noob

Thanks


---
Message posted from http://www.ExcelForum.com/




mushy_peas[_6_]

DIM is what i am
 
well i used
Sheets("Till").Select
so i was on the right sheet. but it doesn work
:O

--
Message posted from http://www.ExcelForum.com


Peter Atherton[_10_]

DIM is what i am
 
Try this

Dim last as integer, next as integer

Sub findRow()

last = application.worksheetfunction.counta(RAnge("A:A"))
next= last + 1
and the rest of your code here..
End sub

Regards
Peter
-----Original Message-----
Say i have

Dim Current
Dim Last

and i had a cell with a number, how do i set Current to

be equal that
that value. isnt it:-

Current = Range("H1")

or am i just being a noob

Thanks


---
Message posted from http://www.ExcelForum.com/

.


Tom Ogilvy

DIM is what i am
 
Sub Testcurrent()
Dim current as variant, current1 as Variant
Dim rng a range
set rng = worksheets("Till").Range("H1")
current = worksheets("Till").Range("H1").Value
current1 = rng.Value
msgbox Current & " - " & Worksheets("Till").Range("H1").value & _
vbNewline & Current1 & " - " & rng.Value & vbNewline & _
rng.Address(external:=True)

End sub

--
Regards,
Tom Ogilvy


mushy_peas wrote in message
...
well i used
Sheets("Till").Select
so i was on the right sheet. but it doesn work
:O(


---
Message posted from http://www.ExcelForum.com/




mushy_peas[_7_]

DIM is what i am
 
i dont get this bit
application.worksheetfunction.counta(RAnge("A:A"))
could you pls explain, ta


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

DIM is what i am
 
It will tell you how many cells in column A are not empty. (it counts how
many are no empty - it is using the excel worksheet function COUNTA as in

=COUNTA(A:A)



--
Regards,
Tom Ogilvy

mushy_peas wrote in message
...
i dont get this bit
application.worksheetfunction.counta(RAnge("A:A"))
could you pls explain, ta


---
Message posted from http://www.ExcelForum.com/




mushy_peas[_8_]

DIM is what i am
 
Thank You, Thank You!

Dim rng a range
set rng = worksheets("Till").Range("H1")
current = worksheets("Till").Range("H1").Value

It all works fine now. but why do i need "set rng
worksheets("Till").Range("H1")"

and can you just have "rng = worksheets("Till").Range("H1")". wots th
dif

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

DIM is what i am
 
Demonstrating several concepts for you. Use what you need.

it is sometime useful (less typing) to set a range reference (a variable
that holds a reference to a range object) to a cell or range. then you can
use this variable. this is especially true if you are working between two
workbooks.

--
Regards,
Tom Ogilvy

mushy_peas wrote in message
...
Thank You, Thank You!

Dim rng a range
set rng = worksheets("Till").Range("H1")
current = worksheets("Till").Range("H1").Value

It all works fine now. but why do i need "set rng =
worksheets("Till").Range("H1")"

and can you just have "rng = worksheets("Till").Range("H1")". wots the
diff


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com