Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default EXCEL MACRO HELP

So i'm new at working with macros.
I have an excel sheet that allows a user to select a state and a city from
that state. Each city has a website that is identified to it. The goal is
to be able to click a button that will open the hyperlinked website for a
choosen city. At the moment I have a macro that is assigned to a button and
opens the hyperlink and imports the data, but the website will not change
when I change the city. Any suggestions?

As clarification, the website I want to be opened is run through a lookup
with a hyperlink, so by changing the city, the website changes and you can
click on the link and it will open up the website. So that portion works
correctly.

--
THANKS
~Steph
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default EXCEL MACRO HELP

On Jun 17, 10:56*am, Steph wrote:
So i'm new at working with macros.
I have an excel sheet that allows a user to select a state and a city from
that state. *Each city has a website that is identified to it. *The goal is
to be able to click a button that will open the hyperlinked website for a
choosen city. *At the moment I have a macro that is assigned to a button and
opens the hyperlink and imports the data, but the website will not change
when I change the city. *Any suggestions?

As clarification, the website I want to be opened is run through a lookup
with a hyperlink, so by changing the city, the website changes and you can
click on the link and it will open up the website. *So that portion works
correctly.

--
THANKS
~Steph


Your hyperlink isn't changing because it's assuming the text is all
that's changing... you may want to consider using the santax below...

Sub CommandButton1_Click()

ActiveWorkbook.FollowHyperlink = Range("A1").Value

End Sub

Range A1 would contain the URL of the webaddress your trying to get
to. This way your not dependant on the URL constantly being refreshed.
I suppose you could have the URL change in range A1 if you combined a
few cells...

Range A1 Formula
="Http://www.MyCoolCity.Com/"&A2&"/"&A2&".htm"

Range A2 = City Name either by a Vlookup statement or by the end user
typing something in.

Your message is some what confusing so I hope that this helps you out.
You can also send me your workbook
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default EXCEL MACRO HELP


--
THANKS
~Steph


"Shaka215" wrote:

On Jun 17, 10:56 am, Steph wrote:
So i'm new at working with macros.
I have an excel sheet that allows a user to select a state and a city from
that state. Each city has a website that is identified to it. The goal is
to be able to click a button that will open the hyperlinked website for a
choosen city. At the moment I have a macro that is assigned to a button and
opens the hyperlink and imports the data, but the website will not change
when I change the city. Any suggestions?

As clarification, the website I want to be opened is run through a lookup
with a hyperlink, so by changing the city, the website changes and you can
click on the link and it will open up the website. So that portion works
correctly.

--
THANKS
~Steph


Your hyperlink isn't changing because it's assuming the text is all
that's changing... you may want to consider using the santax below...

Sub CommandButton1_Click()

ActiveWorkbook.FollowHyperlink = Range("A1").Value

End Sub

Range A1 would contain the URL of the webaddress your trying to get
to. This way your not dependant on the URL constantly being refreshed.
I suppose you could have the URL change in range A1 if you combined a
few cells...

Range A1 Formula
="Http://www.MyCoolCity.Com/"&A2&"/"&A2&".htm"

Range A2 = City Name either by a Vlookup statement or by the end user
typing something in.

Your message is some what confusing so I hope that this helps you out.
You can also send me your workbook

Thanks for the help, but I don't think it is working correctly still due to
the fact that my hyperlink I want it to follow is first a VLOOKUP command.

Here is what my macro looks like that works correctly except not changing
the web address when the city is changed.

Sub data_finder()
'
' data_finder Macro
'

'
Range("G3").Select
Workbooks.Open Filename:= _
"http://www.columbus.com"
ActiveWindow.Visible = False
Windows("724339TY.csv").Visible = True
Cells.Select
Selection.Copy
Windows("Dataorganization.xlsm").Activate
Sheets("Data").Select
Cells.Select
ActiveSheet.Paste
Range("B5").Select
Sheets("Instructions").Select
Windows("724339TY.csv").Activate
ActiveWindow.Close
Sheets("Instructions").Select
End Sub

G3 is the position of the web address which looks like...
=HYPERLINK(LOOKUP(D3,O3:Q15,3,FALSE))

All values in the Q column are web address, but they are not hyperlinked
until after the LOOKUP command has run.

Does this make more sense?
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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
translate lotus 1-2-3 macro into excel macro using excel 2000 krutledge0209 Excel Programming 1 November 2nd 04 05:50 PM
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet wyndman Excel Programming 2 May 25th 04 06:59 PM


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