Error - Need assistance Please - Object doesn't support thisproperty...

B

Bull

The following error : run-time error 438 occures when I click a button
called Add to ledger:

Sub ADDtoLedger_Click()
Dim sh As Worksheet, lastrow As Long
Set sh = Worksheets("Data")
With Worksheets("Log")
lastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
If lastrow = True Then lastrow = Cells(Rows.Count,
1).End(xlDown).Row + 1
.Cells(.Row).Value = sh.Range("C3").Value & ", " & _
sh.Range("C5").Value & " " & sh.Range("C7").Value
.Cells(lastrow, 2).Value = sh.Range("W3").Value
End With

End Sub

Can someone help me out with this code - the error says Object doesn't
support this property or method. In the VB editor it yellows the
rows .Cells(.Row).Value and sh.Range("C5...

I am trying to track all the data I enter on one sheet (called Data)
to a ledger that has all entries from previous occasions (called
Log).

Thanks, Bull
 
E

Ed from AZ

You have:

With Worksheets("Log")

and then

.Cells(.Row).Value

The Worksheet object doesn't have a .Row property.

You apparently want a value for the row, yes? How are you capturing
that value?

Also, I think Cells want (row, column), which would be two numbers.
Like you have in:
.Cells(lastrow, 2).Value = sh.Range("W3").Value


Ed
 
B

Bull

You have:

With Worksheets("Log")

and then

.Cells(.Row).Value

The Worksheet object doesn't have a .Row property.

You apparently want a value for the row, yes?  How are you capturing
that value?

Also, I think Cells want (row, column), which would be two numbers.
Like you have in:
  .Cells(lastrow, 2).Value = sh.Range("W3").Value

Ed








- Show quoted text -

The value for .Row is taken from Data Sheeet.

Cells that contain Last, First, and Middle names are C3, C5 and C7.

The Last, First, MName is transferred to the sheet Log on the next
available row down.
So I need to define further.

Not sure what I need to do to fix. Thanks for the replies.
Bull
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top