View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default how to assign contents of a cell to a macro variable

either:
CellDesc = ActiveWorkbook.Sheets("General Documentation").Cells("a6").Value
(Notice the "A6" change.)

or

CellDesc = ActiveWorkbook.Sheets("General Documentation").Cells(6,"A").Value



DavidH wrote:

Hi,

I'm trying to set the contents of cell A6 in the "General Documentation"
worksheet of the active workbook to a variable. First I test for the General
Documentation worksheet, and that part of my code works. Here's the next part:

Dim CellDesc As String
CellDesc = ActiveWorkbook.Sheets("General Documentation").Cells(a6).Value

I get error 1004, application defined or object defined error. Should I be
using something else besides string? Does it make a difference if the cell
value is a string or a number?

Thanks for the help!

David


--

Dave Peterson