VBA code - saving of data in different excel file.

Radek1

New Member
Joined
Apr 17, 2019
Messages
11
Dears,

I would like to kindly ask you for your help regards VBA code.

Issue: I'm having very simple data entry form (kind of attendance list / evidence). I need to upgrade this code - currently data inserted to form are stored in different sheet of same excel file.
I need to also save entered data in another excel file - on shared drive...

I believe for someone very easy (I'm beginner with VBA)
This is complete code I have currently...

Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long




Private Sub CommandButton1_Click()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
Dim n As Long


Unload Me


n = sh.Range("A" & Application.Rows.Count).End(xlUp).Row




sh.Range("A" & n + 1).Value = Me.ComboBox2.Value
sh.Range("B" & n + 1).Value = Me.ComboBox3.Value
sh.Range("C" & n + 1).Value = Format(Now(), "dd.mm.yyyy")
sh.Range("d" & n + 1).Value = Format(Now(), "hh:mm")
sh.Range("E" & n + 1).Value = Me.TextBox1.Value




End Sub




Private Sub UserForm_Activate()

With Me.ComboBox2
.Clear
.AddItem ""
.AddItem "Z0001"
.AddItem "Z0002"
.AddItem "Z0003"



End With


With Me.ComboBox3
.Clear
.AddItem ""
.AddItem "Pøíchod do práce"
.AddItem "Odchod z práce"


End With
End Sub

Thanks for your help in advance...

Radek
 

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)

Forum statistics

Threads
1,214,798
Messages
6,121,635
Members
449,043
Latest member
farhansadik

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