Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default Drop down or Combo Box Help with VBA code and formula

I am trying to create a drop down menu that will go to the specific
cell where that same text is in a worksheet when that text is selected
from the dropdown menu(combobox). I made a combobox menu from the
Forms menu not the Control. The text I am trying to find with this
macro is a list of countries in column B that starts row 2. In
Columns C,D, E there are surcharges that start in row 2 and continue a
number of rows down depending on the country. This format repeats
itself for some 146 countries on down the spreadsheet in terms of
rows. Is there a formula that can jump to or go to each country's
cell location on the spread sheet from the dropdown menu so the user
doesn't have to scroll through 2000 rows to find the right country?
e.g. Brazil is B2, Paraguay-B24, Venezuela-B46. Thanks.

Matty

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Drop down or Combo Box Help with VBA code and formula

try: macro is attached to your combobox and G1 is the link cell for your
combobox. I have assumed your combox input range is in column A.

Sub DropDown1_Change()
ActiveWindow.ScrollRow = 1
nrow = Application.Match(Cells(Range("G1") + 1, "A"), Range("B:B"), 0)
ActiveWindow.ScrollRow = nrow

End Sub

HTH

" wrote:

I am trying to create a drop down menu that will go to the specific
cell where that same text is in a worksheet when that text is selected
from the dropdown menu(combobox). I made a combobox menu from the
Forms menu not the Control. The text I am trying to find with this
macro is a list of countries in column B that starts row 2. In
Columns C,D, E there are surcharges that start in row 2 and continue a
number of rows down depending on the country. This format repeats
itself for some 146 countries on down the spreadsheet in terms of
rows. Is there a formula that can jump to or go to each country's
cell location on the spread sheet from the dropdown menu so the user
doesn't have to scroll through 2000 rows to find the right country?
e.g. Brazil is B2, Paraguay-B24, Venezuela-B46. Thanks.

Matty


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default Drop down or Combo Box Help with VBA code and formula

On Jul 13, 3:02 pm, Toppers wrote:
try: macro is attached to your combobox and G1 is the link cell for your
combobox. I have assumed your combox input range is in column A.

Sub DropDown1_Change()
ActiveWindow.ScrollRow = 1
nrow = Application.Match(Cells(Range("G1") + 1, "A"), Range("B:B"), 0)
ActiveWindow.ScrollRow = nrow

End Sub

HTH



" wrote:
I am trying to create a drop down menu that will go to the specific
cell where that same text is in a worksheet when that text is selected
from the dropdown menu(combobox). I made a combobox menu from the
Forms menu not the Control. The text I am trying to find with this
macro is a list of countries in column B that starts row 2. In
Columns C,D, E there are surcharges that start in row 2 and continue a
number of rows down depending on the country. This format repeats
itself for some 146 countries on down the spreadsheet in terms of
rows. Is there a formula that can jump to or go to each country's
cell location on the spread sheet from the dropdown menu so the user
doesn't have to scroll through 2000 rows to find the right country?
e.g. Brazil is B2, Paraguay-B24, Venezuela-B46. Thanks.


Matty- Hide quoted text -


- Show quoted text -


the last statement, ActiveWindow.ScrollRow = nrow, is giving an
error: nrow = error2042, when I drag the cursor over it. I can't
tell if it works yet.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,339
Default Drop down or Combo Box Help with VBA code and formula

You will get an "nrow" error if it cannot match the country in the drop down
with those in column B.

If still get errors, post sample w/sheet to:

toppers <at NOSPAMjohntopley.fsnet.co.uk

Remove NOSAPAM

Try:

Sub DropDown1_Change()
ActiveWindow.ScrollRow = 1
nrow = Application.Match(Cells(Range("G1") + 1, "A"), Range("B:B"), 0)
If not iserror(nrow) then
ActiveWindow.ScrollRow = nrow
Else
Msgbox Cells(range("G1")+1,"A") & " not found"
end if

" wrote:

On Jul 13, 3:02 pm, Toppers wrote:
try: macro is attached to your combobox and G1 is the link cell for your
combobox. I have assumed your combox input range is in column A.

Sub DropDown1_Change()
ActiveWindow.ScrollRow = 1
nrow = Application.Match(Cells(Range("G1") + 1, "A"), Range("B:B"), 0)
ActiveWindow.ScrollRow = nrow

End Sub

HTH



" wrote:
I am trying to create a drop down menu that will go to the specific
cell where that same text is in a worksheet when that text is selected
from the dropdown menu(combobox). I made a combobox menu from the
Forms menu not the Control. The text I am trying to find with this
macro is a list of countries in column B that starts row 2. In
Columns C,D, E there are surcharges that start in row 2 and continue a
number of rows down depending on the country. This format repeats
itself for some 146 countries on down the spreadsheet in terms of
rows. Is there a formula that can jump to or go to each country's
cell location on the spread sheet from the dropdown menu so the user
doesn't have to scroll through 2000 rows to find the right country?
e.g. Brazil is B2, Paraguay-B24, Venezuela-B46. Thanks.


Matty- Hide quoted text -


- Show quoted text -


the last statement, ActiveWindow.ScrollRow = nrow, is giving an
error: nrow = error2042, when I drag the cursor over it. I can't
tell if it works yet.


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11
Default Drop down or Combo Box Help with VBA code and formula

On Jul 13, 5:28 pm, Toppers wrote:
You will get an "nrow" error if it cannot match the country in the drop down
with those in column B.

If still get errors, post sample w/sheet to:

toppers <at NOSPAMjohntopley.fsnet.co.uk

Remove NOSAPAM

Try:

Sub DropDown1_Change()
ActiveWindow.ScrollRow = 1
nrow = Application.Match(Cells(Range("G1") + 1, "A"), Range("B:B"), 0)
If not iserror(nrow) then
ActiveWindow.ScrollRow = nrow
Else
Msgbox Cells(range("G1")+1,"A") & " not found"
end if



" wrote:
On Jul 13, 3:02 pm, Toppers wrote:
try: macro is attached to your combobox and G1 is the link cell for your
combobox. I have assumed your combox input range is in column A.


Sub DropDown1_Change()
ActiveWindow.ScrollRow = 1
nrow = Application.Match(Cells(Range("G1") + 1, "A"), Range("B:B"), 0)
ActiveWindow.ScrollRow = nrow


End Sub


HTH


" wrote:
I am trying to create a drop down menu that will go to the specific
cell where that same text is in a worksheet when that text is selected
from the dropdown menu(combobox). I made a combobox menu from the
Forms menu not the Control. The text I am trying to find with this
macro is a list of countries in column B that starts row 2. In
Columns C,D, E there are surcharges that start in row 2 and continue a
number of rows down depending on the country. This format repeats
itself for some 146 countries on down the spreadsheet in terms of
rows. Is there a formula that can jump to or go to each country's
cell location on the spread sheet from the dropdown menu so the user
doesn't have to scroll through 2000 rows to find the right country?
e.g. Brazil is B2, Paraguay-B24, Venezuela-B46. Thanks.


Matty- Hide quoted text -


- Show quoted text -


the last statement, ActiveWindow.ScrollRow = nrow, is giving an
error: nrow = error2042, when I drag the cursor over it. I can't
tell if it works yet.- Hide quoted text -


- Show quoted text -


That works! You can ignore my e-mail if you like. Thanks so much for
taking the time with this! I sincerely appreciate it.

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
what is code to activate a combo box in control toolbox Pogo Excel Discussion (Misc queries) 1 July 23rd 06 10:41 AM
Source code for combo box in form shnim1 Excel Discussion (Misc queries) 1 April 14th 06 04:46 AM
combo box on change code frendabrenda1 Excel Discussion (Misc queries) 0 April 10th 06 04:21 PM
Drop Down List Box, Combo Box ExcelUser777 Excel Discussion (Misc queries) 4 April 9th 06 12:51 AM
Combo Box Code jd815 Excel Discussion (Misc queries) 1 September 14th 05 08:53 PM


All times are GMT +1. The time now is 05:33 PM.

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"