Macro to update the existing list entries in share point.

santhoshbes

Board Regular
Joined
Sep 29, 2009
Messages
69
Hi All,
Need your help in Macro to update the existing list entries in share point. I have a macro to upload new entries in share point. Need guidance to edit the existing entries.

Macro to add new entries:

Sub ABM()
Application.ScreenUpdating = False
'Dim g As String
'f = InputBox("Enter your Username(NTLOGIN)")
'Sheet3.Cells(2, 5).Value = f
'g = Sheet1.Cells(4, 5).Value
'Dim z As String
a = MsgBox("Are you sure, you need to upload the data", vbYesNo, "ABM_TT")
'MsgBox g
If a = vbYes Then
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open " Provider = Microsoft.Ace.oledb.12.0;Data source= C:\Users\kumaarsa\Desktop\Automated Files\ABM_TT.accdb"
' open a recordset
Set rs = New ADODB.Recordset
rs.Open "ABM_TT", cn, adOpenKeyset, adLockOptimistic, adCmdTable
' all records in a table
r = 3 ' the start row in the worksheet
Sheets("ABM_TT").Select
n = Sheet1.Range("B1:B100000").SpecialCells(xlCellTypeConstants).Count
'MsgBox n
y = n
For i = 2 To n
'Do While Range("A1").Value > 0
'rng = Sheets("Input").UsedRange
'MsgBox a
' repeat until first empty cell in column A
'a = Date

With rs
.AddNew ' create a new record
' add values to each field in the record
'.Fields("Date") = Sheet1.Cells(i, 1).Value
'.Fields("Title") = "Roles and Responsibilities Tracker"
.Fields("Week Ending") = Sheet1.Cells(i, 1).Value
.Fields("ABM Function or Group") = Sheet1.Cells(i, 2).Value
.Fields("SRM Activities") = Sheet1.Cells(i, 3).Value
.Fields("Other Activities") = Sheet1.Cells(i, 4).Value
.Fields("Description") = Sheet1.Cells(i, 5).Value
.Fields("Hours per Week") = Sheet1.Cells(i, 6).Value
'.Fields("AvailableTime") = Sheet1.Cells(i, 5).Value
'.Fields("UtilizationPercentage") = Sheet1.Cells(i, 9).Value
.Update ' stores the new record
End With
Next i
'r = r + 1 ' next row
rs.Close
Set rs = Nothing
MsgBox "Data Uploaded in Sharepoint", vbInformation, "Result"
Else
MsgBox "Alter the entries and Try again", vbCritical, "ABM_TT"
End If
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,213,565
Messages
6,114,338
Members
448,569
Latest member
Honeymonster123

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