Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default 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
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
copy data from sheet2 to sheet1 when sheet2 has variable # of rows Anne Excel Discussion (Misc queries) 6 February 27th 09 09:48 PM
DataVaildationList works in Sheet1, but does not in Sheet2; Why rseeley Excel Discussion (Misc queries) 1 December 11th 07 10:19 PM
How to find data in Sheet1 and list them in Sheet2 Michael[_44_] Excel Programming 3 October 25th 07 07:41 PM
How do I list all sums from sheet1 to sheet2? neilg_cebu Excel Worksheet Functions 1 March 17th 06 10:26 AM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM


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