Unspecified Range

kkruhaj

New Member
Joined
Nov 17, 2022
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
Hi all. I am working on a spreadsheet where you look at a 4-digit code, and according to that code you break down the amount in the cell next to it by certain percentages. For this, I am using a For loop and if statements (may do cases, but I am still playing around with it). What I want is for the loop to detect if the code is detected, then print the percentages of the amounts in a column, as well as the code next to each cell that has its total broken down. For this, I cannot specify a range to print the percentage amounts in a new worksheet, as it in a loop and I just want my values to print in the same column one after another if the code is detected. If I specify a range to print these values, then if the loop detects the code again, it would reprint in the same cells. I think I may need another loop, but I am unsure if so or what kind if I do. Please let me know if you have any suggestions or if clarification is needed! I am very new to VBA, but have experience in JAVA, so I am trying to make connections there. TIA for any help!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Welcome to the Site!

It is normally more helpful, for everyone, if you provide the code that you have thus far, and a sample of the data that you are working with.

To provide sample data, have a look here

You may not need to supply the entire code that you have, just the code that pertains to your question.
 
Upvote 0
Hard to follow that but maybe all you need is one or a series of Offset(Row,Column) lines. Input and output samples are far better than any description alone that you can give. Copy/paste from sheet is way better than pics of that.
 
Upvote 0
For example, this is one line. Using the code in the right column, I know I want say to break down the total $177.52 into- 25% of the total in one cell, 25% of the total in another cell, 7% in another, and 18% in another (all consecuitvely in one column located in a separate sheet). I want to create a loop that does this for many different codes and continues printing the breakdown of the totals in the same column. Would it be better to use cases or if statements and I am unsure how to do the for loop. If you need a picture of what I would like to happen, I can upload this too (not for school, just for an extra work project, so no rushes on responses).
 

Attachments

  • Screenshot_20221117_044637.png
    Screenshot_20221117_044637.png
    1.4 KB · Views: 4
Upvote 0
Input and output samples are far better than any description alone that you can give. Copy/paste from sheet is way better than pics of that.
So you post a pic anyway - but only of the input? And one row at that? :(
There's data right under 177.52 that would have to be shifted down?? Easier to put your percentage amounts in columns if that's the case - but pure speculation based on lack of information. If that persists I can't help.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,289
Members
449,077
Latest member
Rkmenon

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