Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Horizontal Alignment

I have a Excel document I am creating from data in a Access Database.

I have alot of cells that need to be aligned left, right or center.
Instead of using the Brute force method of defining an alignment for each
individual cell I want to call a Sub Procedure to do the alignment.

Here is my Sub I am calling.
Public Sub AlignRight( _
Optional ByRef rowStart As Integer, _
Optional ByRef rowEnd As Integer, _
Optional ByRef column As String)

Dim x as Integer

x = row start
For counter = rowStart To rowEnd
Range(column & x).HorizontalAlignment = xlRight
x = x +1
Next
End Sub

From my main body of code I call the Sub Procedure with the following line
Call AlignRight(20, 29, "A")

The code runs just fine but the excel document is not modified. The Code
has no problem creating the Excel file, writing the queries from the Access
Database to the Excel file and doing all the other formating I have defined
in the main body of the code but the Sub Procedure doesn't act on the the
Excel file. How do I make the Sub Procedure act on the Excel Spreadsheet?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
In Cell alignment, how do I update the default vertical alignment How to update default cell alignment Setting up and Configuration of Excel 2 February 4th 09 02:25 PM
what does "horizontal alignment = -4108" mean? Sapna Excel Discussion (Misc queries) 1 January 20th 09 06:45 AM
Right Alignment Paul Gauci New Users to Excel 0 August 18th 08 07:33 PM
Alignment ED Excel Programming 1 August 1st 05 04:28 PM
Cells(r, c) syntax and horizontal alignment Neal Zimm Excel Programming 3 January 31st 05 09:01 PM


All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"