Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-12-2021, 01:21 PM
jeffreybrown jeffreybrown is offline VBA insert quick part formula and format as percentage Windows 10 VBA insert quick part formula and format as percentage Office 2016
Expert
VBA insert quick part formula and format as percentage
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default VBA insert quick part formula and format as percentage

It seems I've looked everywhere, but can't seem to find the right way to format a quick part formula as percentage. Here is what I've tried.



Code:
Sub test()
    With ActiveDocument.Tables(1)
        .Cell(5, 5).Formula Formula:="=A2/B2*100"
        .Cell(5, 5).Range.Text = Format(.Cell(5, 5), "0.00%")
    End With
End Sub
I used the macro recorder and came up with the below, works fine, but of course it makes me select the table cell first.

Code:
Sub Macro3()
    Selection.InsertFormula Formula:="=A2/B2*100", NumberFormat:="0.00%"
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA insert quick part formula and format as percentage Insert landscape page as quick part melsmiff12 Word 1 04-28-2017 12:51 PM
Quick Part Galleries dfmdfm Word 1 03-27-2017 04:45 PM
VBA insert quick part formula and format as percentage Quick part building blocks - Formula lukegwilson96 Word 6 12-13-2016 10:46 AM
VBA insert quick part formula and format as percentage Insert quick part when cell contains a value winstond Word VBA 1 09-30-2014 11:45 AM
How to Rename a Quick Part sleake Word 14 10-14-2013 09:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:38 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft