Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Help finding the length of two different columns

Howdy,

Im trying to load two different dynamic arrays with two different column's
data.

One column could be different in size than the other and either column could
be as large as 60000 or as small as one.

What could I use to find the last row of column 1 and then use to find the
last row of column 2. I am trying to fill out the array ranges.

Thanks,

Will

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Help finding the length of two different columns

Considering that all the cells in the column are occupide this will return
the value of the next vacant cell, give it a try, it might be what you need

Use this for column A

For x = 1 to 65536
If sheet1.cells(x, 1).value = "" then
msgbox "" & x
end if
exit for
next

Use this for column B

For y = 1 to 65536
If sheet1.cells(y, 2).value = "" then
msgbox "" & y
end if
exit for
next

It looks for the first instance of nothing and then returns the row number

P.S. On the second line of each script it says Sheet1 change this to Sheets
("YOUR SHEET NAME") ie

For y = 1 to 65536
If sheets("Your Sheet ").cells(y, 2).value = "" then
msgbox "" & y
end if
exit for
next



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1
  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Help finding the length of two different columns

Assuming column1 is Column A, and column2 is Column B, to find the last row
of Column A and Column B on Sheet1 (note I am using the code name for the
worksheet - if you want to use the sheet name use Worksheets("YourSheetName")

Sub test()
With Sheet1
MsgBox .Cells(.Rows.Count, 1).End(xlUp).Row
MsgBox .Cells(.Rows.Count, 2).End(xlUp).Row
End With
End Sub

"willz99ta via OfficeKB.com" wrote:

Howdy,

Im trying to load two different dynamic arrays with two different column's
data.

One column could be different in size than the other and either column could
be as large as 60000 or as small as one.

What could I use to find the last row of column 1 and then use to find the
last row of column 2. I am trying to fill out the array ranges.

Thanks,

Will

--
Message posted via http://www.officekb.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Help finding the length of two different columns

contemplating that you could have data in the very last row of column A or B

Sub test()
With Sheet1
If .Cells(.Rows.Count, 1).Value < "" Then
RowA = .Rows.Count
Else: RowA = .Cells(.Rows.Count, 1).End(xlUp).Row
End If
If .Cells(.Rows.Count, 2).Value < "" Then
RowB = .Rows.Count
Else: RowB = .Cells(.Rows.Count, 2).End(xlUp).Row
End If
End With
End Sub




"willz99ta via OfficeKB.com" wrote:

Howdy,

Im trying to load two different dynamic arrays with two different column's
data.

One column could be different in size than the other and either column could
be as large as 60000 or as small as one.

What could I use to find the last row of column 1 and then use to find the
last row of column 2. I am trying to fill out the array ranges.

Thanks,

Will

--
Message posted via http://www.officekb.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Help finding the length of two different columns

Thank you this code was perfect for what I needed.

Thanks again and keep it up!,
Will

JMB wrote:
contemplating that you could have data in the very last row of column A or B

Sub test()
With Sheet1
If .Cells(.Rows.Count, 1).Value < "" Then
RowA = .Rows.Count
Else: RowA = .Cells(.Rows.Count, 1).End(xlUp).Row
End If
If .Cells(.Rows.Count, 2).Value < "" Then
RowB = .Rows.Count
Else: RowB = .Cells(.Rows.Count, 2).End(xlUp).Row
End If
End With
End Sub

Howdy,

[quoted text clipped - 10 lines]

Will


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1
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
pre-set the length of columns Dave[_8_] New Users to Excel 1 September 6th 08 04:07 PM
Finding a string of unknown length in a string of unknown length, Help! Hankjam[_2_] Excel Discussion (Misc queries) 8 July 3rd 08 06:49 PM
Finding cells of different string length. kingie Excel Discussion (Misc queries) 5 March 13th 08 12:31 AM
Max/Min for variable length columns Tim Rush[_2_] Excel Programming 6 January 5th 06 04:36 PM
different length columns dsal Excel Discussion (Misc queries) 5 July 5th 05 06:27 PM


All times are GMT +1. The time now is 06:23 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"