Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Set Column choice to a variable from a Drop Down

This is a segment of a working macro where I would like to be able to choose the column in a drop down to for Set rngFirst =


strFindWhat = Range("G1")

Set rngFirst = Range("A:A").Find(What:=strFindWhat, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)


Basically I want to change A:A to B:B or C:C by selecting it from a drop down and look for "strFindWhat" in that column.

So if I chose C:C in the drop down then I would have:

Set rngFirst = Range("C:C").Find(What:=strFindWhat,

Thanks.
Howard

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Set Column choice to a variable from a Drop Down

Hi Howard,

Am Mittwoch, 30. Oktober 2013 09:27:48 UTC+1 schrieb Howard:
This is a segment of a working macro where I would like to be able to choose the column in a drop down to for Set rngFirst =


e.g. in F1 the dropdown with 1; 2 and 3 then:

Set myRng = Columns(Range("F1"))
Set rngFirst = myRng.Find(What:=strFindWhat, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

Kind Regards
Claus B.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Set Column choice to a variable from a Drop Down


This is a segment of a working macro where I would like to be able to choose the column in a drop down to for Set rngFirst =




e.g. in F1 the dropdown with 1; 2 and 3 then:



Set myRng = Columns(Range("F1"))

Set rngFirst = myRng.Find(What:=strFindWhat, _

LookAt:=xlPart, _

SearchOrder:=xlByRows, _

SearchDirection:=xlNext, _

MatchCase:=False)



Kind Regards

Claus B.


That plugs in quite nicely.

Thank, Claus.

Howard
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Set Column choice to a variable from a Drop Down

Hi Howard,

Am Mittwoch, 30. Oktober 2013 12:32:49 UTC+1 schrieb Howard:

That plugs in quite nicely.


that also works with A, B and C into the dropdown in F1:

Set myrng = Columns(Range("F1").Text)
Set rngfirst = myrng.Find(What:=strFindWhat, _
LookIn:=xlValues, lookat:=xlPart, _
SearchOrder:=xlByRows)

Kind Regards
Claus B.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Set Column choice to a variable from a Drop Down


that also works with A, B and C into the dropdown in F1:



Set myrng = Columns(Range("F1").Text)

Set rngfirst = myrng.Find(What:=strFindWhat, _

LookIn:=xlValues, lookat:=xlPart, _

SearchOrder:=xlByRows)



Kind Regards

Claus B.


Using numbers 1 and 2 in F1 I dimmed myRng as Range which works.

Using A, B, C in F1 I get Object Required or Type Mismatch when Dimming myRng as Range, String or Variant.

Howard


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
Drop Down choice needs to lead to another drop down menu Hudson Excel Discussion (Misc queries) 1 January 9th 09 12:36 AM
run code *after* drop down list choice [email protected] Excel Programming 2 February 10th 08 06:04 PM
Sorting based on Drop Down choice [email protected] Excel Discussion (Misc queries) 5 March 23rd 07 07:58 PM
How do i create a multiple choice drop down list Piper Charts and Charting in Excel 3 September 8th 05 12:40 AM
How do I set up a drop down choice in a cell CELL DROP DOWN MENU Excel Discussion (Misc queries) 3 May 14th 05 06:48 AM


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