PDA

View Full Version : Quick few questions



james123
12-19-2006, 04:44 PM
Hi guys,

Quick few questions I need some help with:

1) Is there a way to make a macro go to the first blank row? For example, I have a few sheets all with different amounts of information in them, when I click a button "New" the macro enters a few bits of standard information, copyed from another sheet, into the cells, but I have to manually click on a new blank row and selected the first cell before clicking the button. I would like the macro to automatically go to the first blank cell, is it possible?

2) I have another macro that is started by pressing another button "Go", this searches the workbook for the information entered in cell “I7” is there a way to make the macro run when the “enter or return” key is press on the keyboard so the button does not have to pressed?

3) is it possible to make a macro (again linked to a button named "done") save the workbook?

4)lastly I have a form that searches as said in question 2, is there a way to add a “next button” that would move down the sheet a row at a time, for example row 16 is displayed in the form pressing the Next button would display row 17

Thanks for your help guys,

James :bow:

ps. the workbook is attached in the post below

mdmackillop
12-19-2006, 04:55 PM
Hi James
Is this a follow up to your previous question?

james123
12-19-2006, 05:01 PM
erm, same workbook yer (new questions) but the workbook has changed quite a bit, i will attach it to this.

Do the questions make sence? :help

mdmackillop
12-19-2006, 05:36 PM
1) Assign each of the New buttons to this sub.
Sub NewRec()
Dim Tgt As Range
Application.ScreenUpdating = False
Set Tgt = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1)
With Sheets("Data")
.Range("J3") = .Range("J5")
.Range("K3") = .Range("J5")
.Range("H3:S3").Copy Tgt
End With
Application.ScreenUpdating = True
End Sub

2) Paste this into the Menu Sheet module
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0, 0) = "I7" Then FRM_Search.Show False
End Sub
3)
Sub DoSave()
ActiveWorkbook.Save
End Sub

4)
Private Sub cmdNext_Click()
Dim i As Long
Set c = Cells(ActiveCell.Row + 1, 1)
c.Select
txtToFind = c.Value
For i = 1 To 14
Controls("textbox" & i).Text = c.Offset(0, i - 1)
Next
End Sub

james123
12-19-2006, 06:40 PM
Thank you so much, you truly are an excel wiz