Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting and using a cell range with a cursor 1

Status
Not open for further replies.

MarkGorecki

Technical User
Jul 1, 2004
7
US
How would a newbie (like myself) be able to select the cell range using a cursor, instead of hard coding the cell range, then pass the range on to the code?

For example, my code has:
Dim varRange As Variant
On Error Resume Next
Set varRange = _
Application.InputBox("Select a range of cells:", Type:=8)
If IsObject(varRange) = False Then Exit Sub
MsgBox varRange.Range

Then below I have (created from recording a macro)
ActiveChart.SetSourceData Source:=Sheet("Chart_Data").Range("A1:D6"), -

Where ("A1:D6") was the range selected in the macro. I would like to use the range selected from the cursor.
 
Hi,
Code:
...
Set MyChart = [i]whateverchartobject[/i]

MyChart.SetSourceData Source:=varRange

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top