Transfer Data to Specific Rows on another spreadsheet From User Form Inputs

Julyna

New Member
Joined
Nov 2, 2018
Messages
5
Hi, there,

I'm still quite new in this and struggling with a macro for staff data input. I have an input box on the first page and I want to save the first few inputs on the first page and next few on second page, but to match the record for the same person. I hope I was clear. Can you give a hand, please?:confused:

Here is my code:

Keyboard Shortcut: Ctrl+r
'
Dim Date_Input
Dim Date_Joined As Date


Range("Block_Start").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select

ActiveCell = InputBox("Enter Surname", "Staff List")
If ActiveCell = "" Then End
ActiveCell.Offset(0, 1).Select

ActiveCell = InputBox("Enter Initials", "Staff List")
If ActiveCell = "" Then End
ActiveCell.Offset(0, 1).Select

ActiveCell = InputBox("Enter Department", "Staff List")
If ActiveCell = "" Then End
ActiveCell.Offset(0, 1).Select

ActiveCell = InputBox("Enter Phone Number", "Staff List")
If ActiveCell = "" Then End
ActiveCell.Offset(0, 1).Select


GetDate:
Date_Input = InputBox("Enter Date Joined", "Staff List")
'
' Solicit the date into Date_input (Dim'ed As Variant)
' Validate Date_Input to contain a valid date value
' Move Date_Input into Date_Joined (Dim'ed as Date) to ensure value is treated as local (European) date
'
If Date_Input = "" Then End


If Not IsDate(Date_Input) Then GoTo GetDate
Date_Joined = Date_Input
ActiveCell = Date_Joined

ActiveCell.Offset(-1, 1).Select
Selection.AutoFill Destination:=ActiveCell.Range("A1:A2"), Type:= _
xlFillDefault
ActiveCell.Range("A1:A2").Select
Range("A1").Select

ActiveCell = InputBox("Enter Home Address", "Staff List")
If ActiveCell = "" Then End
Worksheets("Sheet2").Activate
Cells.Offset(5, 2).Select


End Sub

Thank you in advance!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi,
Which inputs do you want to distribute across sheet1 and which across sheet2?

Also, do you have a unique reference for each employee like employee no?

Dave
 
Upvote 0
Hi, Dave, thank you for your time :)
I would like to keep the home address and tel number on page 2, rest of all on page 1.
No, they don't have, I've just mirrored col A (Surname) and B (Initials) from page 1 to page 2, so the records on each row should be for the same person
Thanks a lot!
 
Upvote 0
Hi,
should be possible - will have a look further when have some free time.

Dave
 
Upvote 0
Hi,
just to confirm

Sheet1 "Surname", "Initials", "Department", "Date Joined"

Sheet2 "Surname", "Initials" "Home Address", "Phone Number"

Also, code you have is for an InputBox not a Userform you mention in the title of your post.

Inputbox is a lot simpler & can be made to do what you want but need to understand if this what you want?

Dave
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top