Macro and Triangle

dennisli

Well-known Member
Joined
Feb 20, 2004
Messages
1,070
How to write Macro to automatically link the latest diagonal to the column which is shown in the table? Thanks


45 23 12 44 45 56 56
56 12 23 89 46 46
68 10 45 78 78
91 23 56 56
79 45 45
52 52
 

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.
Hi!
Do you mean like this?
Book1
ABCDEFGH
145231244455656
2561223894646
36810457878
491235656
5794545
65252
Sheet2
<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> Triangle()
    lastrow = Range("a65536").End(xlUp).Row
    maxcol = lastrow
    <SPAN style="color:#00007F">For</SPAN> i = lastrow<SPAN style="color:#00007F">To</SPAN> 1<SPAN style="color:#00007F">Step</SPAN> -1
        Range(Cells(i, maxcol + 2), Cells(i, maxcol + 2)).Value = Range(Cells(i, maxcol - i + 1), Cells(i, maxcol - i + 1))
    <SPAN style="color:#00007F">Next</SPAN> i<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
Thanks, I will test tomorrow.
By the way, can you tell me how you pasted the Excel format you showed here on the board?
Good night.
Best regards.
Dennis
 
Upvote 0
Theres a dowlloadable file below this post, name colo's html maker. its an add in to make java script of your worksheet.
you can use that to post your sheet here in this board.
Good nyt! Have a peaceful nyt!
 
Upvote 0
Hi Dennis:

Here is a formula based solution ...
Book1
ABCDEFGHI
14523124445565656
256122389464646
3681045787878
49123565656
579454545
6525252
Sheet4


I know you asked for a macro based solution, so the preceding formula-based solution may or may not be of any interest to you.
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,521
Members
449,088
Latest member
RandomExceller01

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