Hello,
I have a database which is just straight columns of data. From A:AO
I also created a data edit page that allows them to search by time and date and return those results. Then they can type in column E on the edit page and change the values for that time and date.
At the bottom I am capturing the database entry number, time, date etc..along with the previous entry if they don't update all of it and only update 1 or 2 entries.
The below code is just making a new line, instead of editing the line it was on.
Like if entry 03/15/2023 at 0900 and that was database entry 619, I change one entry from 568925 to 568926 it should just copy all the old entries and then take the new entry and put it in at 619. A60-AK60 has all of the data including the database entry code for the edit. If you need more information please ask.
Thanks for any help
Sub db_update_entry()
Application.ScreenUpdating = False
Sheets("Entry Edit").Range("A60:AK60").Copy
Worksheets("db").Activate
Dim CompId As Range
Set CompId = Range("A:A").Find(what:=Range("AO1").Value, LookIn:=xlValues, lookat:=xlWhole)
Range(CompId.Offset(, 0), CompId.Offset(, 0)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
UserName = Environ("username")
CompId.Offset(, 39).Value = UserName
CompId.Offset(, 40).Value = Date
Application.ScreenUpdating = True
End Sub
I have a database which is just straight columns of data. From A:AO
I also created a data edit page that allows them to search by time and date and return those results. Then they can type in column E on the edit page and change the values for that time and date.
At the bottom I am capturing the database entry number, time, date etc..along with the previous entry if they don't update all of it and only update 1 or 2 entries.
The below code is just making a new line, instead of editing the line it was on.
Like if entry 03/15/2023 at 0900 and that was database entry 619, I change one entry from 568925 to 568926 it should just copy all the old entries and then take the new entry and put it in at 619. A60-AK60 has all of the data including the database entry code for the edit. If you need more information please ask.
Thanks for any help
Sub db_update_entry()
Application.ScreenUpdating = False
Sheets("Entry Edit").Range("A60:AK60").Copy
Worksheets("db").Activate
Dim CompId As Range
Set CompId = Range("A:A").Find(what:=Range("AO1").Value, LookIn:=xlValues, lookat:=xlWhole)
Range(CompId.Offset(, 0), CompId.Offset(, 0)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
UserName = Environ("username")
CompId.Offset(, 39).Value = UserName
CompId.Offset(, 40).Value = Date
Application.ScreenUpdating = True
End Sub