PDA

View Full Version : Global failure



The"Truth"
11-13-2008, 01:06 PM
I am trying to send this info back to and excel worksheet called Downtime data.
Everything goes fine until I get down to the

Cells(NextRow, 1) = LabelDate.Caption

Then I get this error message.

Method of "Cells" of Object' _Global Failed

Here is an example of what's surrounding my error


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

Someone please help.

Norie
11-13-2008, 02:29 PM
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

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