View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DMoney DMoney is offline
external usenet poster
 
Posts: 130
Default Help with Grabbing Cell Value from Range

try this

dim sftDB as string
sheets("Dashboard").select
strDB=range("c2").value


"Chris C" wrote:

This is the code I have:

' Grab the database name
Dim strDb As Range
Set strDb = Worksheets("Dashboard").Range("C2")
Dim strDBString As String
Set strDBString = strDb.Text

The range is assigned without a problem; however, extracting the actual text
value seems never to work. Can anyone clarify exactly how this should happen?

My underlying motivation is to pull a cell value in VBA, and then use that
in a SQL query within VBA as well.