View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default HELP: insert data in new row

yes - I gave you the code in my response ....

"sam" wrote:

I will try and find out if there are any columns that should have data
always, But is there a way to check multiple column cells as compared to just
one?

"Patrick Molloy" wrote:

you don't say how many columns you have.
You're using A, but are there any other columns that must always have data.

Set DestRow = GetLastRow

Function GetLastRow() As Long
Dim rw As Long
rw = 1
Do Until rw = Rows.Count
If WorksheetFunction.CountA(worksheets("????").Rows(r w)) = 0 Then
GetLastRow = rw
Exit Function

End If
rw = rw + 1
Loop
End Function




"sam" wrote:

Hi All,

I want to update a worksheet through excel userform. and want to populate a
new row everytime a user submits the data through the userform.
To do That I have the following line of code:

Set DestRow = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0).Row

But with this line, it populates the new row if there is data in first cell
of the previouis row, If the first cell of the previous row has no data
(other cells have data) then It overrites the data in that row.

Hope I made it clear

Thanks in advance