Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Lynn Bales
 
Posts: n/a
Default How do I find the last row of data and then use that as a variable

I've been concatenate two columns together and using a defined range, but
when I do this I always wind up with either not enough rows, or to many rows.
I'd like to know how to find the last row of data and then use that in a
macro to only concatenate what I have, is this possible?


  #2   Report Post  
FSt1
 
Posts: n/a
Default

hi,
how are you concatenating now?

regards
FSt1

"Lynn Bales" wrote:

I've been concatenate two columns together and using a defined range, but
when I do this I always wind up with either not enough rows, or to many rows.
I'd like to know how to find the last row of data and then use that in a
macro to only concatenate what I have, is this possible?


  #3   Report Post  
dominicb
 
Posts: n/a
Default


Good afternoon Lynn Bales


The macro below will find the last row of column a and the last row of
column b, concatenate the two strings in the cell and put the answer in
cell C1.

Sub Test()
a = Application.WorksheetFunction.CountA(Range("A:A"))
b = Cells(a, 1).Value
c = Application.WorksheetFunction.CountA(Range("B:B"))
d = Cells(c, 2).Value
Range("C1").Value = b & d
End Sub

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=392490

  #4   Report Post  
Duke Carey
 
Posts: n/a
Default

If you are trying to find the last used row in a column, use something like
this

Dim rng As Range
Set rng = Range("a65536").End(xlUp)

which will set rng to the very last used cell in col A (assuming you don't
have data all the way down to the last row)


"Lynn Bales" wrote:

I've been concatenate two columns together and using a defined range, but
when I do this I always wind up with either not enough rows, or to many rows.
I'd like to know how to find the last row of data and then use that in a
macro to only concatenate what I have, is this possible?


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 03:31 AM.

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"