Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 2
Default data entry and saves it to sheet 2

Basically I need a simpler data entry with submit button and saves it
on the sheet 2.
I have 2 sheets:
1st sheet would be entry fields that I would enter data on, such as:
Account Number, Company Name, Product, etc.
after entering those fields I would just hit 'submit' or 'enter' then
it says on Sheet 2.

I really would like to impress my boss... so your help is much
appreciated.
:) thanks

  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 35,218
Default data entry and saves it to sheet 2

Saved from a previous post--you'll have to change your addresses:

Option Explicit
Sub testme01()

Dim historyWks As Worksheet
Dim inputWks As Worksheet

Dim nextRow As Long
Dim oCol As Long

Dim myRng As Range
Dim myAddresses As String
Dim myCell As Range

myAddresses = "A1,F9,A2,B1"

Set inputWks = Worksheets("Input")
Set historyWks = Worksheets("Summary")

With historyWks
nextRow = .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row
End With

With inputWks
Set myRng = .Range(myAddresses)

If Application.CountA(myRng) < myRng.Cells.Count Then
MsgBox "Please fill in all the cells!"
Exit Sub
End If
End With

With historyWks
With .Cells(nextRow, "A")
.Value = Now
.NumberFormat = "mm/dd/yyyy hh:mm:ss"
End With
.Cells(nextRow, "B").Value = Application.UserName
oCol = 3
For Each myCell In myRng.Cells
historyWks.Cells(nextRow, oCol).Value = myCell.Value
myCell.ClearContents 'clean it up???
oCol = oCol + 1
Next myCell
End With

End Sub

I check to see if all the cells have something in them (maybe not required???).

I also add the date/time to column A of the summary sheet and the username
(taken from Tools|options|General tab) to column B.

Then Column C to xxxx go in the same order as the addresses you've specified in
this line:

myAddresses = "A1,F9,A2,B1"

(Change that to match your input worksheet.

(mycell.clearcontents may not be necessary, too.)


If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

YOUNGIN wrote:

Basically I need a simpler data entry with submit button and saves it
on the sheet 2.
I have 2 sheets:
1st sheet would be entry fields that I would enter data on, such as:
Account Number, Company Name, Product, etc.
after entering those fields I would just hit 'submit' or 'enter' then
it says on Sheet 2.

I really would like to impress my boss... so your help is much
appreciated.
:) thanks


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data in Excel permanently to Access WDR Links and Linking in Excel 1 January 12th 06 03:56 AM
Validate MsgBox Entry to Data in Cells David Excel Discussion (Misc queries) 13 December 21st 05 10:31 PM


All times are GMT +1. The time now is 04:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"