MayraBotla
New Member
- Joined
- Jan 2, 2024
- Messages
- 2
- Platform
- Windows
So I tried and I am new to VBA however tried this much and this worked . Basically copying data from one sheet to another. But I wanted something like when I share this file with the team members and when they hit submit all their answers should be saving in one single workbook that is saved in my computer.
here is the code I tried:
Sub Submit()
Dim wkdatabse As Worksheet
Dim AddDatabse As Range
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want To save the data?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Set wkdatabse = Sheet4
Set AddDatabse = wkdatabse.Cells(wkdatabse.Cells(wkdatabse.Rows.Count, "A").End(xlUp).Row + 1, 1)
With AddDatabse
.Offset(1, 0).Value = Sheets("Imaging").Range("p6").Value
.Offset(0, 1).Value = Sheets("Imaging").Range("p7").Value
.Offset(0, 2).Value = Sheets("Imaging").Range("p8").Value
.Offset(0, 3).Value = Sheets("Imaging").Range("p9").Value
.Offset(0, 4).Value = Sheets("Imaging").Range("p10").Value
.Offset(0, 5).Value = Sheets("Imaging").Range("p11").Value
End With
End Sub
Appreciate your help. So this one when they hit submit in imaging tab the data entered there will be saved in sheet 4
here is the code I tried:
Sub Submit()
Dim wkdatabse As Worksheet
Dim AddDatabse As Range
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want To save the data?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Set wkdatabse = Sheet4
Set AddDatabse = wkdatabse.Cells(wkdatabse.Cells(wkdatabse.Rows.Count, "A").End(xlUp).Row + 1, 1)
With AddDatabse
.Offset(1, 0).Value = Sheets("Imaging").Range("p6").Value
.Offset(0, 1).Value = Sheets("Imaging").Range("p7").Value
.Offset(0, 2).Value = Sheets("Imaging").Range("p8").Value
.Offset(0, 3).Value = Sheets("Imaging").Range("p9").Value
.Offset(0, 4).Value = Sheets("Imaging").Range("p10").Value
.Offset(0, 5).Value = Sheets("Imaging").Range("p11").Value
End With
End Sub
Appreciate your help. So this one when they hit submit in imaging tab the data entered there will be saved in sheet 4