copy columns to other work sheet for variable number of rows

Watersource

New Member
Joined
Jan 3, 2009
Messages
17
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello fellow excel/vba users,

I have a sheet (basically a csv sheet that has been opened in tab Data, and converted to columns) that contains a variable number of rows in a fixed format.
This sheet contains a header and a number of entries. Per entry, the value of column 1 needs to be upgraded.
I want to convert the beneath steps in a macro, so the user only has to press a button and the sheet is filled automatically.
I have tried to copy all rows of the same entry in one go but did not succeed on this. Is my conclusion correct that I need to go through all lines one by one?
What would be the mechanism to determine the number of rows and how can I create a for ... next loop to through all the lines?
One last question, in the source tab I have separate columns for debet and credit amounts, how can I translate this to one column where debet is a positive amount and credit is a negative amount?

Thank you for your help on this.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
As example the source and target sheets, per payment there is one entry, then the entry number needs to be increased.
Also the columns need to be evaluated, e.g. the debet and credit column should be translated to one amount column where amount is positive when origin is debet and negative when credit.
 

Attachments

  • target sheet.png
    target sheet.png
    14.1 KB · Views: 3
  • source sheet.png
    source sheet.png
    10.2 KB · Views: 3
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,162
Members
453,021
Latest member
Justyna P

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