Private Sub Updateform()
Dim WB As Workbook
Dim URL As Variant
Dim Sh As Worksheet
Dim WB1 As Workbook
Dim i As Integer
Dim LR As Long
Dim stext As String
Dim stext1 As String
Application.DisplayAlerts = False
ThisWorkbook.Activate
Set WB = ThisWorkbook
Application.DisplayAlerts = False
ThisWorkbook.Activate
Set Sh = ThisWorkbook.Sheets("Database")
irow = ThisWorkbook.Sheets("Database").[Counta(Database!A:A)] + 1
With Sh
ThisWorkbook.Sheets("Emailtosend").Range("A1999").Value = FirstForm2.UD1.Value
stext = ThisWorkbook.Sheets("Emailtosend").Range("A1999").Value
End With
ThisWorkbook.Sheets("Database").Select
Range("A1").Select
On Error Resume Next
ActiveCell.Select
Dim UID As String
UID = stext
For i = 2 To irow
If ThisWorkbook.Worksheets("Database").Cells(i, 10).Value = UID Then
Worksheets("Database").Cells(i, 3).Value = FirstForm2.lstprocessingdate.Value 'iam able to update date
Worksheets("Database").Cells(i, 4).Value = FirstForm2.lstprocessed1.Value
Worksheets("Database").Cells(i, 8).Value = FirstForm2.survey1.Value ' this is a combobox though I change new value it is still not getting updated
Worksheets("Database").Cells(i, 6).Value= FirstForm2.lstcomments.Value ' this is comment box still the new comments are not getting updated
End If
Next
Dim ncell As Range
For Each ncell In Sheets("temp").Range("Checkrange")
With Sh
If FirstForm2.Controls(ncell.Value) = "" Then
MsgBox ("Make sure all text boxes have entries")
Exit Sub
Else
End If
End With
Next ncell
URL = "https://audit.global.com/sites/AdminSS/Shared%20Documents/Training%20Materials/SS%20recurring%20request%20Handbooks/Test/Updated%20Quality%20Tracker.xlsx?d=w68cd37bd0505426fb4d6fe38c21e23a8"
Set WB1 = Workbooks.Open(URL)
Application.Visible = False
Debug.Print WB1.FullName
Set WB1 = ActiveWorkbook
WB1.LockServerFile
If Err.Number <> 0 Then
MsgBox "File is already open, request you to wait for 10 minutes!"
GoTo 0
Err.Clear
Else
MsgBox "The form is getting updated"
End If
Dim rng1 As Variant
WB1.Activate
Range("J1").EntireColumn.Select
Selection.Copy
Range("K1").EntireColumn.Select
Selection.PasteSpecial xlPasteValues
Dim stext2 As String
stext2 = ThisWorkbook.Sheets("Emailtosend").Range("A1999").Value
WB.Activate
WB.Sheets("Database").Range("A1").Select
'If WB1.Worksheets("Database1").Cells(i, 10).Value = UID Then
Set rng1 = Cells.Find(What:=stext2, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
ActiveCell.Select
ActiveCell.entirerow.Select
Selection.Copy ' copying the entirerow and I want to paste this data in sheet from sharepoint
WB1.Activate
WB1.Sheets("Database1").Select
Set rng1 = Cells.Find(What:=stext2, _
After:=ActiveCell, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)
ActiveCell.Select
ActiveCell.entirerow.Select
Selection.PasteSpecial xlPasteValues ' I want to paste here after searching the text value
WB1.Save
WB1.Close ' to close sharepoint excel
msgvalue = MsgBox("The information has been updated", vbOKOnly)
0:
Application.Visible = False
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.Visible = False
End Sub
I want to update existing macro sheet by calling existing details from userform unique ID and then update new details entered in the existing sheet and other tracker in Sharepoint. Please help
Let me know if you have any questions. Not sure what else to add to this question. Initially the code has to modify the existing details and update the new details and then open Sharepoint Excel and check the unique code, either delete the entire row of the unique code or update the new details by overwriting the existing details in Sharepoint Excel