LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Define range by last cell in column?

Thank you for the help Mr. Peterson! It works great.

"Dave Peterson" wrote:

Private Sub UserForm_Initialize()

Dim ListBoxRange As Range
Dim LastRow As Long

with worksheets("somesheetnamehere")
LastRow = .Cells(.Rows.Count, "F").End(xlUp).Row
Set ListBoxRange = .Range("A4:F" & LastRow)
end with

with me.listbox1
.clear
.columncount = listboxrange.columns.count
.list = listboxrange.value
end with

End Sub

AUCP03 wrote:

This is what I have been trying to get to work.

Private Sub UserForm_Initialize()
Me.ListBox1.Clear

Dim ListBoxRange As Range
Dim LastRow As Long

LastRow = Cells(Rows.Count, "F").End(xlUp).Row

Set ListBoxRange = Range(A4, Cells(LastRow, "F"))

Me.ListBox1.List = Sheet1.Range("ListBoxRange").Value
End Sub

"AUCP03" wrote:

I have a userform listbox. This list box is currently populated by range
A4,F173 Column F is the only one with an entry in every used row. All rows
from A4 to F(last row) will have data in them, but not in all columns except
for column F. How can I define this range to capture the range from
A4,F(last used)?


--

Dave Peterson

 
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 have a cell value define a dynamic named range? CellShocked Excel Worksheet Functions 15 October 26th 11 02:08 AM
Add Edit/Define Range Name to right click on cell Markmmx Excel Discussion (Misc queries) 0 October 26th 06 12:54 AM
Define a range of rows having the same value in one column [email protected] Excel Programming 4 October 6th 06 08:17 PM
Define Range based on cell color StephanieH Excel Programming 6 December 15th 04 04:24 PM
define end column in a range Chris Perry Excel Programming 1 October 1st 03 08:13 PM


All times are GMT +1. The time now is 05:38 AM.

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"