View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Orlando Orlando is offline
external usenet poster
 
Posts: 16
Default Improving this code

Hi guys, I wonder if someone may help me to improve this code, basically read
the worksheet "Personal Budget" until it find the word Final, the are some
empty lines that is why I ask if the cell is not empty, if is not empty I
copy the information sequentially to the worksheet where I am running the
Command Button, this code works but I was wondering if there is a way to
improved, maybe there is a way to do it without the do while cycle.

Thanks

Private Sub CommandButton1_Click()
Dim Row As Integer, row2 As Integer, Count As Integer
Row = 1
row2 = 5

Do While Worksheets("Personal Budget").Cells(row2, 2) < "Final"
If Worksheets("Personal Budget").Cells(row2, 2) < "" Then
Cells(Row, 1) = Worksheets("Personal Budget").Cells(row2, 2).Value
Row = Row + 1
End If
row2 = row2 + 1
Loop
End Sub