How To auto clear contents in a column and make the new values that will be added to accumulate a certain column

Nothando

New Member
Joined
Apr 21, 2021
Messages
18
Office Version
  1. 2013
Platform
  1. Windows
Please help with the VB code for the following issue i need to sort.
i have an excel spread sheet and i want column " I " to auto delete contents everyday,
then i want the new values that i will add on column I to accumulate or be added on the Previous numbers that are in column G.
Column G contains the total numbers of what has been done from day 1 January to 31 December every year, so column I is what am doing daily.
so i want my daily numbers to auto delete and the new values added to accumulate in column G.
Kindly Help with the right VB code to do this.
Thank you....
 
hey p
Not Sheet1(Raw Data) only sheet name within Parenthesis then Don't change my code & use it.
lease do not get tired of helping me,
now copied your code as it is and i pasted it on ThisWorkbook, and i run..it gave me an empty popup box, so i closed the the workbook, then when i open tit again ,it gives me attached error, and the values in column I are still there
 

Attachments

  • Error 3.JPG
    Error 3.JPG
    73.1 KB · Views: 3
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
1. Why your Data at column G is right-aligned, Are they Text (not Number)?
2. When See Error , click on Debug and see what line is yellow. Also hover mouse pointer to Range("G" & I).Value to See Value of it and then take screenshot and sent to me.
 
Upvote 0
Hi
Then Use my code uploaded at post #6
It first accumulate numbers from column I to G then Delete data at column I Whenever you open file.
Hi Are you still there?
i have copied your code on post #6 as it is..but when i run macro, its giving me a mismatch error.
Please help, what do i do now?
 

Attachments

  • mismatch error.JPG
    mismatch error.JPG
    67.8 KB · Views: 3
Upvote 0
1. Why your Data at column G is right-aligned, Are they Text (not Number)?
2. When See Error , click on Debug and see what line is yellow. Also hover mouse pointer to Range("G" & I).Value to See Value of it and then take screenshot and sent to me.

Please Answer my question & test this code also:

VBA Code:
Private Sub Workbook_Open()
Dim i As Long, Lr As Long, Sh As Worksheet
Set Sh = Sheets("Raw Data")
With Sh
Lr = .Range("I" & Rows.Count).End(xlUp).Row
For i = 2 To Lr
.Range("G" & i).Value = .Range("I" & i).Value + .Range("G" & i).Value * 1
Next i
.Range("I2:I" & Lr).ClearContents
End With
End Sub
 
Upvote 0
1. Why your Data at column G is right-aligned, Are they Text (not Number)?
2. When See Error , click on Debug and see what line is yellow. Also hover mouse pointer to Range("G" & I).Value to See Value of it and then take screenshot and sent to me.
1. my data in Column G is only numbers no text.
2. Please see attached screenshot. error type is mismatch
 

Attachments

  • error line.JPG
    error line.JPG
    66.6 KB · Views: 4
Upvote 0
Please Answer my question & test this code also:

VBA Code:
Private Sub Workbook_Open()
Dim i As Long, Lr As Long, Sh As Worksheet
Set Sh = Sheets("Raw Data")
With Sh
Lr = .Range("I" & Rows.Count).End(xlUp).Row
For i = 2 To Lr
.Range("G" & i).Value = .Range("I" & i).Value + .Range("G" & i).Value * 1
Next i
.Range("I2:I" & Lr).ClearContents
End With
End Sub
i have copy and paste the above code and it still give the mismatch error
 
Upvote 0
Please Answer my question & test this code also:

VBA Code:
Private Sub Workbook_Open()
Dim i As Long, Lr As Long, Sh As Worksheet
Set Sh = Sheets("Raw Data")
With Sh
Lr = .Range("I" & Rows.Count).End(xlUp).Row
For i = 2 To Lr
.Range("G" & i).Value = .Range("I" & i).Value + .Range("G" & i).Value * 1
Next i
.Range("I2:I" & Lr).ClearContents
End With
End Sub
please attached for error in this code
 

Attachments

  • Debug error.JPG
    Debug error.JPG
    60.9 KB · Views: 2
Upvote 0
please
please attached for error in this code
s
Please Answer my question & test this code also:

VBA Code:
Private Sub Workbook_Open()
Dim i As Long, Lr As Long, Sh As Worksheet
Set Sh = Sheets("Raw Data")
With Sh
Lr = .Range("I" & Rows.Count).End(xlUp).Row
For i = 2 To Lr
.Range("G" & i).Value = .Range("I" & i).Value + .Range("G" & i).Value * 1
Next i
.Range("I2:I" & Lr).ClearContents
End With
End Sub
please share your email address...let me share the whole spreadsheet with you...
 
Upvote 0
Please Upload your file to free hosting site e.g. www.dropbox.com or GoogleDrive or OneDrive and Insert Link here.
Or upload your Data with XL2BB ADDIN (Preferable)
Or Also Hover mouse to this parameters when you see error & Debug it?
1. i
2. Lr
3. Range("I" & i).value
and give me values
 
Upvote 0
Please Upload your file to free hosting site e.g. www.dropbox.com or GoogleDrive or OneDrive and Insert Link here.
Or upload your Data with XL2BB ADDIN (Preferable)
Or Also Hover mouse to this parameters when you see error & Debug it?
1. i
2. Lr
3. Range("I" & i).value
and give me values
1. i=81
2.Lr=23111
3.Range("I" & i).value=200

and am still trying to upload the file
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,392
Members
449,445
Latest member
JJFabEngineering

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