|
-
Jan 28th, 2009, 12:35 PM
#1
Thread Starter
New Member
Excel 2007 Macro Help (Buttons)
Hi I was wondering if someone could help me.
I am creating a fairly simple excel data sheet to help out in work. I'll explain what I am trying to get it to do, then you might get the idea of where I am going wrong and hopefully point me in the right direction.
I deal will a lot of return parts from one manufacturer and at present we have to look up each part number of there on line site to see what it is.
So I have set up a spreadsheet with the first column containing the common search parameter replicated in each cell:
Example: http://h20141.www2.hp.com/hpparts/Se...earchCriteria=
And the next column has the barcode part numbers scanned in
Example: A9739-69008
In the following Colum I placed the formula =HYPERLINK(A1&""&B1) then copied and pasted in all the cells in the column.
The combined result gives me a hyperlink to that parts information:
http://h20141.www2.hp.com/hpparts/Se...ia=A9739-69008
Now although this works great as a hyperlink to each part description, it looks untidy.
What I want to do is create a button that can be pressed on each row than can do the same thing withoutlooking so untidy.
I tried to create a macro for a button on the first row with the following code:
Sub HP_link_2()
ActiveWorkbook.FollowHyperlink Address:= Range("C1"),
NewWindow:=True
End Sub
But it’s nowhere near right.
Can someone help please?
-
Jan 28th, 2009, 01:28 PM
#2
Re: Excel 2007 Macro Help (Buttons)
you could add a button, which would open the parts site with the search criteria being the activecell value:
vb Code:
Private Sub CommandButton1_Click()
Dim partsSiteURL As String
partsSiteURL = "http://h20141.www2.hp.com/hpparts/SearchCriteria="
ActiveWorkbook.FollowHyperlink Address:=partsSiteURL & ActiveCell.Value
End Sub
then you'd just need a column with the barcode part numbers.
Last edited by .paul.; Jan 28th, 2009 at 01:33 PM.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jan 29th, 2009, 06:42 AM
#3
Thread Starter
New Member
Re: Excel 2007 Macro Help (Buttons)
Thanks for your reply.
Sorry for being completely stupid and no doubt you will laugh at this question.
If the active cell is for example D1, what whould the exact code look like that I would have to put in to the button macro.
I have tried a few variations with no luck
-
Jan 29th, 2009, 08:47 AM
#4
Re: Excel 2007 Macro Help (Buttons)
you'd use the code i posted in post #2.
to run it you'd select cell D1 for example, then click the button...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|