Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"