Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using a variable in a word table formula

Posted on 2010-08-22
2
Medium Priority
?
282 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
MeLindaJohnson earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
Suggested Courses

636 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