Data record in loop (repeated in cycle)

sanpatil108

New Member
Joined
Jul 26, 2022
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Condition 1 - start from prev 1 to prev 7 column and copy data from i Column (ABC) & j Column (XYZ)
Condition 2 - after prev 7 column repeat Record data start from prev1 column
Condition 3 - Highlight the current recording "Cell" using color


VBA Code ...

Public oiTimer As Boolean
Sub DataCopy()
Application.ScreenUpdating = False
\\Do Until Application.ScreenUpdating = False

Sheets("Analysis").Range("I2:I4").Copy
Sheets("Analysis").Range("H2").PasteSpecial xlPasteValues
Application.CutCopyMode = False

Set a1 = Sheets("Analysis").Range("H2:H4")
Set a2 = Sheets("Analysis").Range("B2:B4").End(xlToRight).Offset(0, -1)
a1.Copy a2

Sheets("Analysis").Range("J2:J4").Copy
Sheets("Analysis").Range("K2").PasteSpecial xlPasteValues
Application.CutCopyMode = False

Set a3 = Sheets("Analysis").Range("K2:K4")
Set a4 = Sheets("Analysis").Range("Q2:Q4").End(xlToLeft).Offset(0, 1)
a3.Copy a4

\\Application.CutCopyMode = False
Application.ScreenUpdating = True

\\Loop

End Sub

Sub startTimer()
If (oiTimer = False) Then
oiTimer = True
RunTimer
End If
End Sub

Sub stopTimer()
oiTimer = False
End Sub

Sub RunTimer()
If (oiTimer = True) Then
itime = ThisWorkbook.Worksheets("Analysis").Range("F7").Value
Application.OnTime Now + TimeSerial(0, 0, itime), "runTimer"
DataCopy
End If
End Sub

Sub ClearData()
Sheets("Analysis").Range("B2:H4").ClearContents
Sheets("Analysis").Range("K2:Q4").ClearContents
End Sub
 

Attachments

  • 2022-07-26 at 12-41-18.png
    2022-07-26 at 12-41-18.png
    14.2 KB · Views: 6

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,214,642
Messages
6,120,700
Members
448,979
Latest member
DET4492

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