Consulting

Results 1 to 2 of 2

Thread: Global failure

  1. #1

    Global failure

    I am trying to send this info back to and excel worksheet called Downtime data.
    Everything goes fine until I get down to the

    [VBA]Cells(NextRow, 1) = LabelDate.Caption
    [/VBA]
    Then I get this error message.

    Method of "Cells" of Object' _Global Failed

    Here is an example of what's surrounding my error


    [VBA]Sheets("Downtime Data").Activate
    NextRow = Application.WorksheetFunction. _
    CountA(Range("A:A")) + 1
    Cells(NextRow, 1) = LabelDate.Caption
    Cells(NextRow, 2) = ComboBox11.Text
    Cells(NextRow, 3) = Label4.Caption[/VBA]

    Someone please help.

  2. #2
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Are you sure that when you are trying to find the NextRow the correct sheet is active?

    I know you activate 'Downtime Data' but when you refer to Range("A:A") you don't reference any worksheet.

    Therefore it could be that VBA is 'looking' at what itconsiders the active sheet.

    This also counts for Cells.

    Perhaps this will work
    [vba]
    With Sheets("Downtime Data")
    NextRow = Application.WorksheetFunction.CountA(.Range("A:A")) + 1
    .Cells(NextRow, 1) = LabelDate.Caption
    .Cells(NextRow, 2) = ComboBox11.Text
    .Cells(NextRow, 3) = Label4.Caption

    End With
    [/vba]

Posting Permissions

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