PC Review


Reply
Thread Tools Rate Thread

Dim c as Cell

 
 
Keith Howard
Guest
Posts: n/a
 
      21st Mar 2009
Hello.

I have an embarrassingly simple question. How do I declare a variable as a
Cell? The above line is not compiling.

I have set the following Tools | References:
Visual Basic For Applications
Microsoft Excel 12.0 Object Library
OLE Automation
Microsoft Office 12.0 Object Library

I'm sure I have done this many times in the past successfully, but, for some
reason, it is not working now.

Thanks.

Keith
 
Reply With Quote
 
 
 
 
Legare
Guest
Posts: n/a
 
      21st Mar 2009
Try:

DIM C As Range

A cell is a range containing only one cell.

"Keith Howard" wrote:

> Hello.
>
> I have an embarrassingly simple question. How do I declare a variable as a
> Cell? The above line is not compiling.
>
> I have set the following Tools | References:
> Visual Basic For Applications
> Microsoft Excel 12.0 Object Library
> OLE Automation
> Microsoft Office 12.0 Object Library
>
> I'm sure I have done this many times in the past successfully, but, for some
> reason, it is not working now.
>
> Thanks.
>
> Keith

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      21st Mar 2009
Cell is not a valid object class. You declare a cell as a Range.

Dim c As Range


"Keith Howard" <(E-Mail Removed)> wrote in message
news:68D20E86-BA64-4E65-B90A-(E-Mail Removed)...
> Hello.
>
> I have an embarrassingly simple question. How do I declare a variable as a
> Cell? The above line is not compiling.
>
> I have set the following Tools | References:
> Visual Basic For Applications
> Microsoft Excel 12.0 Object Library
> OLE Automation
> Microsoft Office 12.0 Object Library
>
> I'm sure I have done this many times in the past successfully, but, for
> some
> reason, it is not working now.
>
> Thanks.
>
> Keith



 
Reply With Quote
 
meh2030@gmail.com
Guest
Posts: n/a
 
      21st Mar 2009
On Mar 21, 12:52*pm, Keith Howard
<KeithHow...@discussions.microsoft.com> wrote:
> Hello.
>
> I have an embarrassingly simple question. How do I declare a variable as a
> Cell? The above line is not compiling.
>
> I have set the following Tools | References:
> Visual Basic For Applications
> Microsoft Excel 12.0 Object Library
> OLE Automation
> Microsoft Office 12.0 Object Library
>
> I'm sure I have done this many times in the past successfully, but, for some
> reason, it is not working now.
>
> Thanks.
>
> Keith


Keith,

I'm using Excel 2003, but the only way I know how to dimension a
variable as a "cell" is to dimension the variable as a range.

Dim rngMyCell As Range
Set rngMyCell = Range("A1")

You now have a range object (rngMyCell) which you can manipulate.

Best,

Matt Herbert
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Microsoft Excel Misc 0 29th Jun 2009 11:20 AM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 tviola@wi.rr.com Microsoft Excel Programming 1 21st Aug 2008 10:13 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 tviola@wi.rr.com Microsoft Excel Worksheet Functions 0 21st Aug 2008 08:44 PM
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON CAPTGNVR Microsoft Excel Programming 2 8th Jul 2007 04:18 PM
How to create/run "cell A equals Cell B put Cell C info in Cell D =?Utf-8?B?YWJtYjE2MQ==?= Microsoft Excel Misc 5 26th Jan 2006 06:36 PM


Features
 

Advertising
 

Newsgroups
 


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