VBA - need help to copy data from one file to another file in a different format

alexor2002

New Member
Joined
Dec 10, 2022
Messages
2
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I need your help in automating movement of data from one file to another file but in a different format.

Please find attached the current worksheet (what it looks now) and future worsheet (how it needs to look for the upload to work)

I mention that the number of columns and rows is much greater and I can't figure out how to create a loop that copies and pastes all columns to the right up until last Customer price, (it can be today I have 500 customer price, tomorrow 200, etc.). Same with rows, it might be today I enter 10 codes, tomorrow 1000.
 

Attachments

  • Current worksheet.PNG
    Current worksheet.PNG
    4.3 KB · Views: 2
  • Future worksheet.PNG
    Future worksheet.PNG
    11 KB · Views: 1

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
I am testing and have written a part of the code, but I don't know what to write so that the next interation starts pasting on the fist blank cell in column A

Option Explicit

Sub selectrange()
Dim iterations As Integer, i As Integer, initrange As Range


Range("B4", Range("B4").End(xlToRight)).Select
iterations = Range("B4", Range("B4").End(xlToRight)).Count
For i = 1 To iterations
Range("B4", Range("B4").End(xlDown)).Offset(, i - 1).Copy
Worksheets("Sheet2").Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Next i


End Sub
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,334
Members
449,155
Latest member
ravioli44

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