help with finding out if a cell is empty
help with finding out if a cell is empty
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: help with finding out if a cell is empty

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    ia am trying to run a macro from a command botton only if there is any data in cell a1
    here is my code that does not work
    Private Sub CommandButton1_Click()
    Dim ianswer As Integer

    If ("a1") Is Not Empty Then
    Run ("UploadToDatabaseWT062v8_800")
    ianswer = MsgBox("Upload OK", vbOKOnly)
    Else
    ianswer = MsgBox("There is no data to upload!", vbOKOnly)
    End If
    End Sub



    any hints?
    Thanks,
    W.

  2. #2
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Perhaps the following will work:

    Private Sub CommandButton1_Click()
    Dim ianswer As Integer

    If range("a1") <> "" Then
    Run ("UploadToDatabaseWT062v8_800")
    ianswer = MsgBox("Upload OK", vbOKOnly)
    Else
    ianswer = MsgBox("There is no data to upload!", vbOKOnly)
    End If
    End Sub

    Cheers, Nate

    [ This Message was edited by: NateO on 2002-02-21 08:03 ]

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Getting close,
    Whether the cell is empty or not any code under this line

    If range("a1") <> "" Then

    runs

  4. #4
    New Member
    Join Date
    Feb 2002
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    My mistke! Your code works fine. Thanks for the help!
    W.

  5. #5
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That's my proposition. Getting close or hitting the nail on the head? Hopefully the latter.

    Cheers,

    Nate

  6. #6
    Legend NateO's Avatar
    Join Date
    Feb 2002
    Location
    Minneapolis, Mn, USA
    Posts
    9,700
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Nice! I think yours would too if you just inserted 'range' in front of your cell reference. Good hunting.

    Cheers,
    Nate

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com