Advertisement
popoytanke

submit macro

May 13th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. Sub Submit()
  2. Dim sh As Worksheet
  3. Dim ds As Worksheet
  4. Dim iRow As Long
  5. Set sh = Sheets("Form")
  6. Set ds = Sheets("Database")
  7. iRow = ds.Range("A" & ds.Rows.Count).End(xlUp).Offset(1).Row
  8. Sheet2.Unprotect "12345"
  9. ds.Cells(iRow, 1) = iRow - 1
  10. ds.Cells(iRow, 2).Value = sh.Range("AS4").Value
  11. ds.Cells(iRow, 3).Value = sh.Range("AS5").Value
  12. ds.Cells(iRow, 4).Value = sh.Range("AS6").Value
  13. ds.Cells(iRow, 5).Value = sh.Range("AS7").Value
  14. ds.Cells(iRow, 6).Value = sh.Range("AS8").Value
  15. ds.Cells(iRow, 7).Value = sh.Range("AS9").Value
  16. ds.Cells(iRow, 8).Value = sh.Range("AS10").Value
  17. ds.Cells(iRow, 9).Value = sh.Range("AS11").Value
  18. ds.Cells(iRow, 10).Value = sh.Range("AS12").Value
  19. ds.Cells(iRow, 11).Value = sh.Range("AS13").Value
  20. ds.Cells(iRow, 12).Value = sh.Range("AS14").Value
  21. ds.Cells(iRow, 13).Value = sh.Range("AS15").Value
  22. ds.Cells(iRow, 14).Value = sh.Range("AS16").Value
  23. ds.Cells(iRow, 15).Value = Application.UserName
  24. ds.Cells(iRow, 16).Value = [Text(now(), "MM-DD-YYYY HH:MM:SS")]
  25. sh.Range("F4").Value = ""
  26. sh.Range("F6").Value = ""
  27. sh.Range("F8").Value = ""
  28. sh.Range("F10").Value = ""
  29. sh.Range("F12").Value = ""
  30. sh.Range("F14").Value = ""
  31. sh.Range("F16").Value = ""
  32. sh.Range("F18").Value = ""
  33. sh.Range("Q4").Value = ""
  34. sh.Range("Q6").Value = ""
  35. sh.Range("Q8").Value = ""
  36. sh.Range("Q10").Value = ""
  37. sh.Range("Q12").Value = ""
  38. sh.Range("Q14").Value = ""
  39. sh.Range("Q16").Value = ""
  40. sh.Range("Q18").Value = ""
  41. Sheet2.Protect "12345"
  42. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement