Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Using the data in the last cell

I am trying to define a variable with the data in the last cell in a column.
I've been trying to use the following:

Range("A1").Select
Dim DataCheck2 As Date
DataCheck = Range("A" & (Cells(Rows.Count,
ActiveCell.Column).End(xlUp).Offset(-1, 0).Value)).Value
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Using the data in the last cell

I am trying to define a variable with the data in the last cell in a column.
I've been trying to use the following:

Range("A1").Select
Dim DataCheck2 As Date
DataCheck = Range("A" & (Cells(Rows.Count,
ActiveCell.Column).End(xlUp)Value)).Value
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using the data in the last cell

Dim DataCheck2 as Date
with activesheet
datacheck2 = .cells(.rows.count,"A").end(xlup).value
end with

Watch your variables (datacheck vs. datacheck2)



Amir wrote:

I am trying to define a variable with the data in the last cell in a column.
I've been trying to use the following:

Range("A1").Select
Dim DataCheck2 As Date
DataCheck = Range("A" & (Cells(Rows.Count,
ActiveCell.Column).End(xlUp)Value)).Value


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Using the data in the last cell

this is one way

Sub test()
Range("A1").Select
Dim DataCheck2 As Date
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row

DataCheck2 = Range("A" & lastrow).Value
Debug.Print DataCheck2
End Sub



Gary


--


Gary


"Amir" wrote in message
...
I am trying to define a variable with the data in the last cell in a column.
I've been trying to use the following:

Range("A1").Select
Dim DataCheck2 As Date
DataCheck = Range("A" & (Cells(Rows.Count,
ActiveCell.Column).End(xlUp)Value)).Value



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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i find specific data in a cell and its colocated cell data sfself Excel Worksheet Functions 4 March 27th 09 08:23 AM
converting numerical data in one cell to word data in another cell Vishnu Excel Worksheet Functions 2 June 4th 08 03:14 PM
how to find number in a cell , a cell contains character data ornumeric data [email protected] Excel Worksheet Functions 3 February 19th 08 07:29 PM
Find MAX data in sheet (Cell) - Any cell that exceeds X amount of data confuzedagain Excel Discussion (Misc queries) 1 December 7th 05 05:56 PM
data validation to restrict input in cell based on value of cell above that cell NC Excel Programming 2 January 25th 05 07:11 AM


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

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

About Us

"It's about Microsoft Excel"