ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multiple cells in cells function (https://www.excelbanter.com/excel-programming/355327-multiple-cells-cells-function.html)

Adam

Multiple cells in cells function
 
I want to center a few cells, but my sytax is not correct with the cells
function. Here is what I have. Thanks for the help

cells(3,columnnum:columnnum+2).HorizontalAlignment = xlCenterAcrossSelection

I cannot use the range funtion since my row value is a variable.

DaveO

Multiple cells in cells function
 
You can use the Range function try this...

Range(cells(3, columnnum), cells(3, columnnum +2)).HorizontalAlignment =
xlCenterAcrossSelection

HTH.

"Adam" wrote:

I want to center a few cells, but my sytax is not correct with the cells
function. Here is what I have. Thanks for the help

cells(3,columnnum:columnnum+2).HorizontalAlignment = xlCenterAcrossSelection

I cannot use the range funtion since my row value is a variable.



All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com