Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
combobox list of sheet2
this code is giving active sheet list.
LastRow = Range("H3").End(xlDown).Row myList = Range(Cells(3, 8), Cells(LastRow, 14)).Address what change is to be done to the above code if I want "sheet2 " list with same parameters of above code. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
combobox list of sheet2
Use Address with external = true. this gives the workbook as well so I added
code to remove the workbook. LastRow = Range("H3").End(xlDown).Row MyList = Range(Cells(3, 8), Cells(LastRow, 14)).Address(external:=True) 'remove workbook MyList = Mid(MyList, InStr(MyList, "]") + 1) "tkraju via OfficeKB.com" wrote: this code is giving active sheet list. LastRow = Range("H3").End(xlDown).Row myList = Range(Cells(3, 8), Cells(LastRow, 14)).Address what change is to be done to the above code if I want "sheet2 " list with same parameters of above code. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
combobox list of sheet2
with worksheets("sheet2")
LastRow = .Range("H3").End(xlDown).Row myList = .Range(.Cells(3, 8), .Cells(LastRow, 14)).Address end with fyi this is the same as LastRow = worksheets("sheet2").Range("H3").End(xlDown).Row myList = worksheets("sheet2").Range(.Cells(3, 8), worksheets("sheet2").Cells(LastRow, 14)).Address but from a code perspective, its much cleaner IMHO :) "tkraju via OfficeKB.com" <u16627@uwe wrote in message news:960f49ff0daf2@uwe... this code is giving active sheet list. LastRow = Range("H3").End(xlDown).Row myList = Range(Cells(3, 8), Cells(LastRow, 14)).Address what change is to be done to the above code if I want "sheet2 " list with same parameters of above code. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
combobox list of sheet2
Dim myList as string
Dim LastRow as string With worksheets("Sheet2") lastrow = .range("H3").end(xldown).row mylist = .range("H3:H" & lastrow).address(external:=true) end with I'd leave the workbook name, worksheet name, and address in that string. It won't ever hurt and without it, you may have trouble. "tkraju via OfficeKB.com" wrote: this code is giving active sheet list. LastRow = Range("H3").End(xlDown).Row myList = Range(Cells(3, 8), Cells(LastRow, 14)).Address what change is to be done to the above code if I want "sheet2 " list with same parameters of above code. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
combobox list of sheet2
Thank you,joel.its great,worked perfectly.
joel wrote: Use Address with external = true. this gives the workbook as well so I added code to remove the workbook. LastRow = Range("H3").End(xlDown).Row MyList = Range(Cells(3, 8), Cells(LastRow, 14)).Address(external:=True) 'remove workbook MyList = Mid(MyList, InStr(MyList, "]") + 1) this code is giving active sheet list. LastRow = Range("H3").End(xlDown).Row myList = Range(Cells(3, 8), Cells(LastRow, 14)).Address what change is to be done to the above code if I want "sheet2 " list with same parameters of above code. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
combobox list of sheet2
Thank you Dave.perfectly worked.
Dave Peterson wrote: Dim myList as string Dim LastRow as string With worksheets("Sheet2") lastrow = .range("H3").end(xldown).row mylist = .range("H3:H" & lastrow).address(external:=true) end with I'd leave the workbook name, worksheet name, and address in that string. It won't ever hurt and without it, you may have trouble. this code is giving active sheet list. LastRow = Range("H3").End(xlDown).Row [quoted text clipped - 5 lines] Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy data from sheet2 to sheet1 when sheet2 has variable # of rows | Excel Discussion (Misc queries) | |||
DataVaildationList works in Sheet1, but does not in Sheet2; Why | Excel Discussion (Misc queries) | |||
How to find data in Sheet1 and list them in Sheet2 | Excel Programming | |||
How do I list all sums from sheet1 to sheet2? | Excel Worksheet Functions | |||
ComboBox list reliant on the entry from a different ComboBox | Excel Programming |