Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Centering an Excel cell from VB & How to add variable to Formula? 1

Status
Not open for further replies.

jofarrell

Programmer
Mar 21, 2001
178
US
Is there a way to change the alignment of a cell through VB? I need to center the total lines.

Also I have to sum on a range of cells and I know the x and y corordinates but examples I have seen of adding formulas are more along the lines of .Cells("B17").Formula = "=Sum(d15:d16)"

I need to be able to put the formula in (for example) a cell in (14,7) and sum from x = 8 to x = 23 for y = 11 to 13.

Any comments help or suggestions are greatly welcomed :)

Joanne
 
Aligning:

xlDoc.Worksheets.Application.Range("A1").Justify =vbLeftJustify (vbCenter,vbRightJustify)

Summing:

i don't think I understand you quite clearly but you could

in order to calculate Rows H to AA and Columns 11 to 13 and display the result in N17 =

xlDoc.Worksheets.Application.Range("N7").Cells = "=SUM(H11:AA13)"

Hope it helps

Ciao
 
Thank you so much it was what I was looking for :):)

Joanne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top