VBA Problem

  Bob The Nob© 20:03 07 Nov 2006
Locked

I have a simple conversion VBA program made in Excel, which auto_loads when you open the file.

The problem is I want it to write the results to a worksheet at the next unused cell.
BUT
The code sends it straight to the bottom of the worksheet.
heres the code if your good at VBA:

Private Sub btnsave_Click()
Sheets("Print Sheet").Select
Range("B3").Select
Selection.End(xlDown).Select
Activecall.Offset(1, 0).Activate
ActiveCell = lblinput.Caption
ActiveCell.Offset(0, 1) = txtinput.Text
ActiveCell.Offset(0, 2) = "="
ActiveCell.Offset(0, 3) = lbloutput.Caption
ActiveCell.Offset(0, 1) = txtoutput.Text

End Sub

I need help because I can't see why it wont work!

Thanks
Bob The Nob©

  Bob The Nob© 20:28 07 Nov 2006

^bump

  VoG II 21:13 07 Nov 2006

Well for a start, you don't need to do all this selecting - Selecting is a great way to slow things down.

Dim LastRow as Long
Lastrow = Cells(Rows.Count, 1).End(xlUp).Row

will return the last used row in column A.

  Bob The Nob© 21:16 07 Nov 2006

I need column B.
Range B3:F22

  Bob The Nob© 21:19 07 Nov 2006

its only a quick college task but I need the last part to work, so it I can look back and use it as a referance for my assignment.
Im not bothered about speed

  VoG II 21:42 07 Nov 2006

Lastrow = Cells(Rows.Count, 2).End(xlUp).Row

will find the last row in column B. You should be concerned about speed!

  Bob The Nob© 21:55 07 Nov 2006

Its only a small program

  VoG II 22:04 07 Nov 2006

If you need more help, please ask away.

You may not need speed for this but you should try to achieve the best programming technique.

If you have to do it, and this should be rarely, then .Activate is preferable to .Select.

  Bob The Nob© 22:04 07 Nov 2006

Just emailed you VoG™

  Monoux 22:14 07 Nov 2006

bookmarked

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

The Evil Within 2 review-in-progress

Photoshop CC 2018 released with new Curvature Pen and better brush tools

Camera tips to take better iPhone photos

Les meilleures applications de covoiturage 2017