Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Prompt to Select Cell

I need a Macro command line to prompt the user to select a cell (in this case
a hyperlink), and then continue with my program.

(User starts Macro, Macro prompts for cell/link selection, Macro uses the
link to continue)

No luck finding this in the Posts, Thanks in advance for any ideas.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Prompt to Select Cell

Try something like this:

Sub test()

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Click in a cell with a
hyperlink.", _
Title:="picking a hyperlink", _
Type:=8)

If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If

On Error GoTo 0

MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

End Sub


RBS


"Chris T-M" wrote in message
...
I need a Macro command line to prompt the user to select a cell (in this
case
a hyperlink), and then continue with my program.

(User starts Macro, Macro prompts for cell/link selection, Macro uses the
link to continue)

No luck finding this in the Posts, Thanks in advance for any ideas.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Prompt to Select Cell

Thank You RBS
It mostly worked... Please note I am new at this...

The selection works, but then I can't step back into my program. The rest of
the steps worked previously with a set cell name.

This is what I have: It kicks out on"Selection.Hyperlinks..." and if I
delete that, then it kicks out on the next line, etc.

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select Project Link", _
Title:="picking a hyperlink", _
Type:=8)
If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If
On Error GoTo 0
MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Worksheets("L4_Request").Activate
Range("A10:J10").Select
Selection.Copy
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Windows("Test Book2.xls").Activate
Range("B10").Select
ActiveSheet.Paste
End Sub


"RB Smissaert" wrote:

Try something like this:

Sub test()

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Click in a cell with a
hyperlink.", _
Title:="picking a hyperlink", _
Type:=8)

If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If

On Error GoTo 0

MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

End Sub


RBS


"Chris T-M" wrote in message
...
I need a Macro command line to prompt the user to select a cell (in this
case
a hyperlink), and then continue with my program.

(User starts Macro, Macro prompts for cell/link selection, Macro uses the
link to continue)

No luck finding this in the Posts, Thanks in advance for any ideas.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Prompt to Select Cell

Try this:

Sub test()

Dim rng As Range
Dim oHyperLink As Hyperlink

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select Project Link", _
Title:="picking a hyperlink", _
Type:=8)
If rng Is Nothing Then
On Error GoTo 0
Exit Sub
Else
Set oHyperLink = rng.Hyperlinks(1)
If oHyperLink Is Nothing Then
MsgBox "Need to pick a cell with a hyperlink!", , "picking a
hyperlink"
On Error GoTo 0
Exit Sub
End If
End If

On Error GoTo 0

oHyperLink.Follow NewWindow:=False, AddHistory:=True

End Sub


RBS


"Chris T-M" wrote in message
...
Thank You RBS
It mostly worked... Please note I am new at this...

The selection works, but then I can't step back into my program. The rest
of
the steps worked previously with a set cell name.

This is what I have: It kicks out on"Selection.Hyperlinks..." and if I
delete that, then it kicks out on the next line, etc.

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select Project Link", _
Title:="picking a hyperlink", _
Type:=8)
If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If
On Error GoTo 0
MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Worksheets("L4_Request").Activate
Range("A10:J10").Select
Selection.Copy
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Windows("Test Book2.xls").Activate
Range("B10").Select
ActiveSheet.Paste
End Sub


"RB Smissaert" wrote:

Try something like this:

Sub test()

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Click in a cell with a
hyperlink.", _
Title:="picking a hyperlink", _
Type:=8)

If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If

On Error GoTo 0

MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

End Sub


RBS


"Chris T-M" wrote in message
...
I need a Macro command line to prompt the user to select a cell (in this
case
a hyperlink), and then continue with my program.

(User starts Macro, Macro prompts for cell/link selection, Macro uses
the
link to continue)

No luck finding this in the Posts, Thanks in advance for any ideas.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Prompt to Select Cell

Thank You, That worked very well.

"RB Smissaert" wrote:

Try this:

Sub test()

Dim rng As Range
Dim oHyperLink As Hyperlink

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select Project Link", _
Title:="picking a hyperlink", _
Type:=8)
If rng Is Nothing Then
On Error GoTo 0
Exit Sub
Else
Set oHyperLink = rng.Hyperlinks(1)
If oHyperLink Is Nothing Then
MsgBox "Need to pick a cell with a hyperlink!", , "picking a
hyperlink"
On Error GoTo 0
Exit Sub
End If
End If

On Error GoTo 0

oHyperLink.Follow NewWindow:=False, AddHistory:=True

End Sub


RBS


"Chris T-M" wrote in message
...
Thank You RBS
It mostly worked... Please note I am new at this...

The selection works, but then I can't step back into my program. The rest
of
the steps worked previously with a set cell name.

This is what I have: It kicks out on"Selection.Hyperlinks..." and if I
delete that, then it kicks out on the next line, etc.

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select Project Link", _
Title:="picking a hyperlink", _
Type:=8)
If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If
On Error GoTo 0
MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
Worksheets("L4_Request").Activate
Range("A10:J10").Select
Selection.Copy
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Copy
Windows("Test Book2.xls").Activate
Range("B10").Select
ActiveSheet.Paste
End Sub


"RB Smissaert" wrote:

Try something like this:

Sub test()

Dim rng As Range

On Error Resume Next
Set rng = Application.InputBox(Prompt:="Click in a cell with a
hyperlink.", _
Title:="picking a hyperlink", _
Type:=8)

If rng Is Nothing Then
On Error GoTo 0
Exit Sub
End If

On Error GoTo 0

MsgBox rng.Hyperlinks(1).Address, , "selected hyperlink"

End Sub


RBS


"Chris T-M" wrote in message
...
I need a Macro command line to prompt the user to select a cell (in this
case
a hyperlink), and then continue with my program.

(User starts Macro, Macro prompts for cell/link selection, Macro uses
the
link to continue)

No luck finding this in the Posts, Thanks in advance for any ideas.




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
Prompt user to select directory Dan R. Excel Programming 3 March 2nd 07 07:22 PM
how do I prompt the user to select a cell? [email protected] Excel Programming 1 December 19th 06 11:42 PM
VB select OK from a prompt when running a macro Stig[_3_] Excel Programming 2 July 24th 06 04:31 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:22 PM
Prompt user to select file with default file selected dialog Bob Phillips[_5_] Excel Programming 0 September 14th 03 09:19 PM


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