LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Adding Variables to a range with quotes

This should be so simple!

I am building a subroutine to create a chart based on a selected group of
cells in separated columns.

If I hard-code the statement as Set ChrtRange =
Range("B5:B8,K5:K8")

I can plug ChrtRange into CH.Chart.SetSourceData Source:=ChrtRange,
PlotBy:=xlColumns
and it works great.

But I want to use variables for the "5", the "8" and the "K". It should be
a matter of building th statement up with concatination, but I have been
having a terrible time getting it to work.

I have tried to do it the "simple" way with R1C1 values, but the chart that
comes up includes the intermediate rows, like there is a ":" between the
terms instead of a ",".

Here is my best try, but I get error 424 "Object Required"

Set ChrtRange = "Range(" & Chr(34) & "B" & clTop & ":B" & clBot & "," & Xcol
& clTop & XColB & clBot & Chr(34) & ")"


where clTop = 5, clBot = 8, XCol = "K", and XColB = ":K" and I am using
Chr(34) to insert the needed open and close quotes.


I have been playing around with variations for the last hour and a half, and
pleed for help :)

Thanks !

Incidentally, Here are my declarations, and the variables are correctly
interpreted in the string, it just won't assign.
Global clTop As Integer, clBot As Integer
Global CH As ChartObject
Global ChrtRange As Range, Xcol As String
Global XColB As String


Anyone have some thoughts on this?

Van!!


 
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
Vlookup is adding quotes! Michael Enoksen Excel Worksheet Functions 3 September 25th 08 03:37 PM
Adding a range with three variables Saul Excel Discussion (Misc queries) 4 July 25th 08 02:21 PM
Adding in a range with multiple variables EG Excel Discussion (Misc queries) 2 April 23rd 07 10:38 PM
my code is adding single quotes KCarhart Excel Programming 1 August 4th 05 10:48 AM
Adding quotes to columns Mj Excel Discussion (Misc queries) 3 December 9th 04 03:49 PM


All times are GMT +1. The time now is 05:18 PM.

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"