Moving the data into previous cell by using excel formula or VBA code
Solved/Closed
svtranjit
Posts
1
Registration date
Saturday May 1, 2021
Status
Member
Last seen
May 1, 2021
-
May 1, 2021 at 04:32 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - May 7, 2021 at 03:50 AM
vcoolio Posts 1411 Registration date Thursday July 24, 2014 Status Moderator Last seen September 6, 2024 - May 7, 2021 at 03:50 AM
Related:
- To move to the previous cell
- How to see previous downloads on safari - Guide
- Clear only the formatting from the selected cell (leaving the content) - Guide
- Insert a function in cell b2 to display the current date from your system. ✓ - Excel Forum
- Based on the cell values in cells b77 - Excel Forum
- If cell contains date then return value ✓ - Office Software Forum
1 response
vcoolio
Posts
1411
Registration date
Thursday July 24, 2014
Status
Moderator
Last seen
September 6, 2024
262
May 7, 2021 at 03:50 AM
May 7, 2021 at 03:50 AM
Hello svtranjit,
The following code may help:-
The code assumes that your data is in Sheet1 and starts in row2 with headings in row1. The "repaired" data is transferred to sheet2.
I've attached a sample workbook to show you how this code works. Click on the "TEST ME" button to see how it works.
The code only takes a second to work in the sample but be prepared for it to take up to three minutes to work on about 10,000 rows of data. The time taken may vary from machine to machine.
Here is the link to the sample file:-
https://wetransfer.com/downloads/6849f6666833f01f3ed167765d00487720210507074745/6bc920
I hope that this helps.
Cheerio,
vcoolio.
The following code may help:-
Option Explicit Sub Test() Dim lr As Long: lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row Dim lCol As Long: lCol = Sheet1.Cells(1, Columns.Count).End(xlToLeft).Column Dim i As Long Application.ScreenUpdating = False On Error Resume Next For i = 2 To lr Sheet1.Range(Cells(i, 1), Cells(i, lCol)).SpecialCells(2, 2).Copy Sheet2.Range("A" & Rows.Count).End(3)(2) Next i On Error GoTo 0 Application.ScreenUpdating = True Sheet2.Select End Sub
The code assumes that your data is in Sheet1 and starts in row2 with headings in row1. The "repaired" data is transferred to sheet2.
I've attached a sample workbook to show you how this code works. Click on the "TEST ME" button to see how it works.
The code only takes a second to work in the sample but be prepared for it to take up to three minutes to work on about 10,000 rows of data. The time taken may vary from machine to machine.
Here is the link to the sample file:-
https://wetransfer.com/downloads/6849f6666833f01f3ed167765d00487720210507074745/6bc920
I hope that this helps.
Cheerio,
vcoolio.