Help with a macro that searches, write cell location and divides a number

mike guest98

New member
Joined
Jun 6, 2018
Messages
28
Reaction score
0
Points
0
Excel Version(s)
2010
I would need assistance with developing a new macro. The macro does 2 things: search in a range for numbers 1 to 10 and divide certain numbers by 10, that’s it.

I have 3 examples at the end and have uploaded my sample Excel workbook showing the expected result.

Thank-you in advance for your assistance.


Notes for below:

- Need 2 decimal places on the left and 2 decimal places on the right in every cell.
- I’m using Excel 2010, Sheet 2.
- Please do not hard code I may need to make changes in the future.



1st to do - is to find each possible number in the range and how it must be written. There will always be a positive result with a minimum of 1 and a maximum of 10 (could be expanded in the future) numbers found.

Found number 1, 2, 3, 4 with a positive result:

- Write specific cell location:
Number 1 from cell range, B17:B26, F17:F26, J17:J26 write to cell B7.
Number 2 from cell range, B17:B26, F17:F26, J17:J26 write to cell D7.
Number 3 from cell range, B17:B26, F17:F26, J17:J26 write to cell F7.
Number 4 from cell range, B17:B26, F17:F26, J17:J26 write to cell H7.

Found numbers 5, 6, 7, 8, 9, 10 with a positive result:

Number 5 from cell range, B17:B26, F17:F26, J17:J26 write to cell J7.

Number 6 from cell range, B17:B26, F17:F26, J17:J26 write to cell B14.
Number 7 from cell range, B17:B26, F17:F26, J17:J26 write to cell D14.
Number 8 from cell range, B17:B26, F17:F26, J17:J26 write to cell F14.
Number 9 from cell range, B17:B26, F17:F26, J17:J26 write to cell H14.
Number 10 from cell range, B17:B26, F17:F26, J17:J26 write to cell J14.


2nd to do - Divide the number (located in columns E/I/M, 3 cells to the right of the found number) by 10 up to the number 12.00. After 12.00 the remainder would be written to the listed cell. Add to any existing numbers in any of the cells.


3 Examples with expected results – see sample Excel sheet

The above code is run and the following would occur:

1st Found number – Number 4
- Write B20 (number 4 location) to cell H7.
- Divide 10.00 located in cell E20 by 10 cells C7,E7,G7,I7,K7,C14,E14,G14,I14,K14. Add to any existing numbers in the cell.

2nd Found number - Number 9
- Write F18 (number 9 cell location) to cell H14.
- Write cell contents I18 (10.00) to cell I14, Add to any existing numbers in the cell.

3rd Found Number - Number 1
- Write J26 (number 1 cell location) to cell B7.
- Divide 12.00 by 10 cells C7,E7,G7,I7,K7,C14,E14,G14,I14,K14. The remaining 8.00 would be written to cell C7. Add to any existing numbers in the cell.


Thank-you in advance for any help you can provide.
 

Attachments

  • FIND NUMBERS.xlsx
    6.1 KB · Views: 13
Please also post the code you have created and indicate where things go wrong
 
Hi

I don't have any existing code for the the above. If you could help it would be greatly appreciated.
Mike
 
Hi

Could you please close this post I didn't receive any assistance.

Thanks
 
Hi and welcome
Please,do not crosspost your question on multiple forums without including links here to the other threads on other forums.

Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question

Do not post any further responses in this thread until a link has been provided to these cross posts.
 
Back
Top