Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I am send data to an Excel Spreadsheet, which includes some numeric data and
some text data. I want to have the text in all columns in the centre of the cell. I have tried lots of different code:- xlSheet.Range("A:L").HorizontalAlignment = HorizontalAlignment.Center xlSheet.Cells.HorizontalAlignment = HorizontalAlignment.Center xlSheet.Columns.HorizontalAlignment = HorizontalAlignment.Center xlSheet.Cells(10, 1).HorizontalAlignment = HorizontalAlignment.Left xlSheet.Columns("C").HorizontalAlignment = HorizontalAlignment.Center xlSheet.Range("A6:L15").HorizontalAlignment = HorizontalAlignment.Center xlSheet.Cells.HorizontalAlignment = True xlSheet.Range("A6:L15").HorizontalAlignment = HorizontalAlignment.Center but nothing seems to work. If I use horizontalalignment.left the code will not work and I get error reports. If I use horizontalalignment.right all the cells requested are aligned to the left. If I use horizontalalignment.center the cells are as you would see in a spreadsheet, numeric on the right and text on the left of the cell. All other forms of formatting, i.e. Font.Size, Font.Bold, BorderAround all work. The data is being sent to Excel 2000, may seem a bit archaic but it is only being used to give a direct printout of the data, easier than formatting it into a document. -- Alan M |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Alan -
Maybe xlSheet.Range("A:L").HorizontalAlignment = xlCenter "Alan" wrote: I am send data to an Excel Spreadsheet, which includes some numeric data and some text data. I want to have the text in all columns in the centre of the cell. I have tried lots of different code:- xlSheet.Range("A:L").HorizontalAlignment = HorizontalAlignment.Center xlSheet.Cells.HorizontalAlignment = HorizontalAlignment.Center xlSheet.Columns.HorizontalAlignment = HorizontalAlignment.Center xlSheet.Cells(10, 1).HorizontalAlignment = HorizontalAlignment.Left xlSheet.Columns("C").HorizontalAlignment = HorizontalAlignment.Center xlSheet.Range("A6:L15").HorizontalAlignment = HorizontalAlignment.Center xlSheet.Cells.HorizontalAlignment = True xlSheet.Range("A6:L15").HorizontalAlignment = HorizontalAlignment.Center but nothing seems to work. If I use horizontalalignment.left the code will not work and I get error reports. If I use horizontalalignment.right all the cells requested are aligned to the left. If I use horizontalalignment.center the cells are as you would see in a spreadsheet, numeric on the right and text on the left of the cell. All other forms of formatting, i.e. Font.Size, Font.Bold, BorderAround all work. The data is being sent to Excel 2000, may seem a bit archaic but it is only being used to give a direct printout of the data, easier than formatting it into a document. -- Alan M |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to add text to all cells in excel or merge the text in two ce | Excel Discussion (Misc queries) | |||
Excel Changes Text Cells to Number Cells When Importing XML | Excel Discussion (Misc queries) | |||
3D Text in Excel cells | Excel Discussion (Misc queries) | |||
In Excel, option to enter text in cells the same as text boxes | Excel Worksheet Functions | |||
Text cells in excel | Excel Discussion (Misc queries) |