Formating Problems with VBA code

peter_z

Board Regular
Joined
Feb 27, 2011
Messages
87
Hey Guys

I am trying to get the following code working, it is basically looping filling out box shapes with data. The problem is I am trying to format each box differently, I thought I could create a string and format it but it doesn't seem to work.

Code:
 [FONT=Calibri][FONT=Verdana][SIZE=2]With objShape
                .Select
                Selection.Characters.Text = Format(strTY, strFormat1)
                
            End With [/SIZE][/FONT][/FONT]

The problem is when I put a strFormat1 which is an offset formula for the different formats for each txt box it just pasted the actual value in instead of formatting the box.

I.e "#0.0%" is written in excel instead of formating the txt box as "#0.0%" it will just paste in "#0.0%".

Hope that all makes sense.

Thanks heaps in advance if you can help me with this!!!

Peter
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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