Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 3rd, 2003, 02:18 PM
Authorized User
 
Join Date: Sep 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Know how to convert a range to a string?

Hi,

I've got a range object that I want to convert to a string so I can use in the PivotTableWizard method:

Dim rng As Range
set rng = Sheets("sales").Range("A1").CurrentRegion

I want to convert rng into a string like this:

"sales!R1C1:R796C6"

Any help you can provide will be greatly appreciated.

Robert Stober



 
Old October 3rd, 2003, 02:23 PM
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default


s = "sales!" & rng.Address(ReferenceStyle:=xlR1C1)
 
Old October 4th, 2003, 09:06 PM
Authorized User
 
Join Date: Sep 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you helentoomik. That's much cleener than the way I came up with...

 
Old September 11th, 2009, 10:28 AM
Registered User
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi
how to select data on different sheet
my problem is
i am having data on different sheet and graph on different sheet
the sheet which contains graph is programically created..

thanx n regards
 
Old September 11th, 2009, 09:12 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

In the following code mentioned earlier

s = "sales!" & rng.Address(ReferenceStyle:=xlR1C1)

Replace 'sales' with appropriate sheet name

if the sheet is getting programmatically generated then use that sheet object's name

oSht,Name

or

Activesheet.name




s = Activesheet.name & "!" & rng.Address(ReferenceStyle:=xlR1C1)

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old September 12th, 2009, 08:49 AM
Registered User
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default thanx

thanx for help.. ;)





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert to string prafullaborade XML 7 May 29th, 2008 02:59 PM
convert string to xml prafullaborade XML 3 May 21st, 2008 06:56 AM
Convert string to Date rprasad012 ASP.NET 1.0 and 1.1 Basics 1 March 19th, 2008 07:07 AM
Convert a string into a variable jtrifts VBScript 4 February 21st, 2008 09:08 AM
Convert string to datetime nkovacevic General .NET 4 April 5th, 2005 11:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.