Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Range and Cells method

I am trying to build a range using the following method;

CntRef4 = xlApp.Range(xlApp.Cells(RowRef, ColRef), xlApp.Cells(z, ColRef))

Where CntRef is Range, RowRef,ColRef and z are String. RowRef,ColRef and z
all contain values when I do a mouse over, however CntRef =Nothing. If I
Change CntRef to String it reads =""

How should I look to clear upo this problem
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Range and Cells method

Jenny,

You are missing a set statement for one thing. See the example below which
has made the data typing a bit more obvious and uses numeric data types.

Sub SetRange()
Dim XL As Excel.Application
Dim rngWanted As Range
Dim lRow As Long
Dim nCol As Integer
Dim lRow2 As Long

Set XL = GetObject(, "Excel.Application")
lRow = 1
nCol = 1
lRow2 = 2

With XL
Set rngWanted = .Range(.Cells(lRow, nCol), .Cells(lRow2, nCol))
End With
Debug.Print rngWanted.Address
End Sub

Robin Hammond
www.enhanceddatasystems.com

"Jenny" wrote in message
...
I am trying to build a range using the following method;

CntRef4 = xlApp.Range(xlApp.Cells(RowRef, ColRef), xlApp.Cells(z, ColRef))

Where CntRef is Range, RowRef,ColRef and z are String. RowRef,ColRef and z
all contain values when I do a mouse over, however CntRef =Nothing. If I
Change CntRef to String it reads =""

How should I look to clear upo this problem



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
Set range with Find method jlclyde Excel Discussion (Misc queries) 1 December 3rd 08 05:44 PM
Range.delete method Touk Excel Programming 1 September 28th 04 06:15 AM
Adding named range gives error "method range of object _Global failed " Gunnar Johansson Excel Programming 3 August 10th 04 01:54 PM
Pass a range to a method? Frank Kabel Excel Programming 12 May 21st 04 02:50 AM
Sort method of range Richard Clarke Excel Programming 7 July 25th 03 04:42 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"