How to change a visio shape text to the content of a range stored in a variant?

Michael Ziegler

New Member
Joined
Jul 2, 2019
Messages
8
Hello I'm trying to store the contents of a excel range into a variable and then add the content of the range to the text of a shape in visio. If I use a position like cel (1, 1) it adds the content of the position to the name but I need to add the entire content of the range for the active worksheet to the shape name. Here is a snippet of the code.


Code:
Dim cel As Variant


    cel = Range("A5:A85")




    For i = 2 To sht_count - 1


        With Worksheets(i)                       


            Worksheets(i).Activate               




                Set node = application.ActiveWindow.Page.Drop(Application.DefaultRectangleDataObject, aoffset, boffset)


    
                node.Text = ActiveWorkbook.Worksheets(i).Name + cel

I need to be able to display on the shape the entire content of the variant instead of one of the positions. Thanks
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Maybe something like this
Code:
Sub MichaelZiegler()
   Dim ary As Variant, Txt As String
   ary = Range("A5:A85").Value2
   Txt = Join(Application.Transpose(ary), ", ")
End Sub
This will put the data into a comma separated text string
 
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
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