View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
VBAvirgin
 
Posts: n/a
Default write macro to input data


This is a basic method, the way I started, before getting into UserForms
etc.
Let's assume, you have some data in columns A thru E (5 columns).

Code:
--------------------
Sub NewData()
Dim Config As Integer
Dim Ans As Integer
Application.ScreenUpdating=False
Range("A1").End(xlDown).Select
'This inserts a value of 1 for tabulation. Use Only if you want to'
ActiveCell.Value=(1)
ActiveCell.Offset(rowOffset:=0,columnOffset:=1).Ac tivate
ActiveCell.Value=InputBox("Enter Your Data")
ActiveCell.Offset(rowOffset:=0,columnOffset:=1).Ac tivate
'Inserts the current date'
ActiveCell.Value=Now
ActiveCell.Offset(rowOffset:=0,columnOffset:=1).Ac tivate
ActiveCell.Value=InputBox("Enter Your Data")
ActiveCell.Offset(rowOffset:=0,columnOffset:=1).Ac tivate
ActiveCell.Value=InputBox("Enter Your Data")
ActiveCell.Offset(rowOffset:=0,columnOffset:=1).Ac tivate
ActiveCell.Value=InputBox("Enter Your Data")
'User is prompted to continue or quit'
Ans=MsgBox("Do You Have Additional Entries?", vbYesNo)
If Ans=vbYes Then
Application.Run("NewData")
End If
'Cursor is returned to the Home Cell of A1'
Application.Range("A1").Select
End Sub

--------------------


Hope this helps you some. I know VBA can be a little initimidating when
you first get into it.
Good Luck in your efforts.


--
VBAvirgin
------------------------------------------------------------------------
VBAvirgin's Profile: http://www.excelforum.com/member.php...o&userid=16327
View this thread: http://www.excelforum.com/showthread...hreadid=496474