Solved

using a variable in a word table formula

Posted on 2010-08-22
2
272 Views
Last Modified: 2012-06-21
I want to write a subroutine that puts variables into cells in a table. The subroutine below works perfectly for the job except that I haven't found a way to have a variable in the formula:

With Selection.Tables(1).Rows(row)
    .Cells(1).Range.Text = item
    .Cells(2).Range.Text = desc
    .Cells(3).Range.Text = qty
    .Cells(4).Range.Text = price
    .Cells(5).Formula "=c3*d3\#$,0"
End With

In this routine above the formula is hard coded to row 3. How can I modify that line to make it use the row variable used in the first line of the code snippet?
0
Comment
Question by:karimjohnson
2 Comments
 
LVL 4

Accepted Solution

by:
MeLindaJohnson earned 500 total points
ID: 33498081
With Selection.Tables(1).Rows(row)
    .Cells(1).Range.Text = item
    .Cells(2).Range.Text = desc
    .Cells(3).Range.Text = qty
    .Cells(4).Range.Text = price
    .Cells(5).Formula "=c" & row & "*d" & row & "\#$,0"
End With

0
 

Author Closing Comment

by:karimjohnson
ID: 33501434
Brilliant!
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question