ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set style in Range object? (https://www.excelbanter.com/excel-programming/416153-how-set-style-range-object.html)

SmartGuy

How to set style in Range object?
 
Hi all:
I have two cells:
A B
1 Cell1, Cell2

---------------------------
In excel , i manually set "Cell Styles" to them with "Check Cell", "Heading
1" ... etc.
Question:
I want to code (c#) Cell1 ,Cell2 with such Style, how could i do ?

Sample code is welcomed , especially for c# code.
Thanks in advanced.

Ding Li

NOPIK

How to set style in Range object?
 
Use macro record - you will see the something like
Selection.Font.Superscript = True

Simply use your Excel.Range Object (or OLE) to change the desired
values.


SmartGuy

How to set style in Range object?
 
I can't use macro record because I have to create a new blank excel sheet.
So , is there any c# solution ?

"NOPIK" wrote:

Use macro record - you will see the something like
Selection.Font.Superscript = True

Simply use your Excel.Range Object (or OLE) to change the desired
values.



NOPIK

How to set style in Range object?
 
What do you mean by "I need to create a blank sheet"?
I meaned simple action: Open Excel record macro Cut&Paste Macro into
your code, close Excel, correct objects for your namespace.
Or you don't know how to perform Excel.Application.Workbooks.Open ?

SmartGuy

How to set style in Range object?
 
I got your idea. Record what you have done in excel and take advantage of
these codes.
Thanks, i will try.

"NOPIK" wrote:

What do you mean by "I need to create a blank sheet"?
I meaned simple action: Open Excel record macro Cut&Paste Macro into
your code, close Excel, correct objects for your namespace.
Or you don't know how to perform Excel.Application.Workbooks.Open ?



All times are GMT +1. The time now is 10:42 PM.

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