Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.controls
external usenet poster
 
Posts: 19
Default vbAccelerator sGrid control- spacing columns.

Is there a forum or something dedicated to vbAccelerator controls?

I have a grid placed on an XL VBA userform, and was wondering how would I
set the width of the two columns, equally, upon startup. This is my code so
far:

Private Sub UserForm_Initialize()

With grdTransCalc
.Header = True
.AddColumn vKey:="TOTAL", sHeader:="Total",
ealign:=ecgHdrTextALignCentre
.AddColumn vKey:="AMT", sHeader:="Amount",
ealign:=ecgHdrTextALignCentre
.AutoWidthColumn "TOTAL"
.AutoWidthColumn "AMT"
If .ColumnWidth("TOTAL") < 60 Then .ColumnWidth("TOTAL") = .Width /
2
If .ColumnWidth("AMT") < 60 Then .ColumnWidth("AMT") = .Width / 2

End With
End Sub

The above code doesn't space the columns correctly! Is there a better way?

--

Julian Milano



  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.controls
external usenet poster
 
Posts: 2
Default vbAccelerator sGrid control- spacing columns.

It appears that the AutoWidthColumn sizes them to the length of the text.
Try this:

With vbalGrid1
.Header = True
.AddColumn "TOTAL", "TOTAL", ecgHdrTextALignCentre, , 60
.AddColumn "AMT", "AMT", ecgHdrTextALignCentre, , 60
' .AutoWidthColumn "TOTAL"
' .AutoWidthColumn "AMT"
End With

"Julian Milano" wrote in message
...
Is there a forum or something dedicated to vbAccelerator controls?

I have a grid placed on an XL VBA userform, and was wondering how would I
set the width of the two columns, equally, upon startup. This is my code

so
far:

Private Sub UserForm_Initialize()

With grdTransCalc
.Header = True
.AddColumn vKey:="TOTAL", sHeader:="Total",
ealign:=ecgHdrTextALignCentre
.AddColumn vKey:="AMT", sHeader:="Amount",
ealign:=ecgHdrTextALignCentre
.AutoWidthColumn "TOTAL"
.AutoWidthColumn "AMT"
If .ColumnWidth("TOTAL") < 60 Then .ColumnWidth("TOTAL") = .Width

/
2
If .ColumnWidth("AMT") < 60 Then .ColumnWidth("AMT") = .Width / 2

End With
End Sub

The above code doesn't space the columns correctly! Is there a better way?

--

Julian Milano





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
Outline/group 2 columns- what puts the control on the left vs righ frustrated Excel Discussion (Misc queries) 0 December 10th 08 03:59 AM
Compare two columns by aligning same-values and spacing out differences Jon Davis Excel Worksheet Functions 1 December 12th 07 02:55 AM
calendar control in 3 columns tmirelle Excel Discussion (Misc queries) 2 March 19th 07 07:26 PM
Pasting from clipboard-how to control text-to-columns delimiting stebro Excel Discussion (Misc queries) 1 June 15th 05 05:31 PM
Problem hiding/unhiding columns using combo control olivier durand Excel Programming 2 October 28th 03 03:07 PM


All times are GMT +1. The time now is 07:54 PM.

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"