Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




**RESOLVED** MERGE && SPLIT Cells In Excel Using VB


Hi guys,

i have problem in merging and spliting cells in excel sheet.
i have a template and i am using 8 columns.

either of the below solution is ok for me

Option 1
i want to merge 4 columns each (making 8 columns to 2)

Option 2
right now i am able to merge whole row altogether.
is it possible to spli the same row into 2 columns ?

pls suggest

thanx in advance




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
SORT OF RESOLVED - Merge All Cells In First Two Rows
I have a MSFlexgrid which has 3 fixed rows. I am trying to merge all the cells in the first two rows to make just the one big cell. All of the data in the cells are the same. This is my code so far, and below that is how it looks at the moment.
Code:With grdCourseList

    .Rows = 4
    .FixedRows = 3
    
    .Cols = 3
    
    '...set col width
    .ColWidth(0) = 1400
    .ColWidth(1) = 2000
    .ColWidth(2) = 3000
    
    '...set col alignnment
    .ColAlignment(0) = flexAlignLeftCenter
    .ColAlignment(1) = flexAlignLeftCenter
    .ColAlignment(2) = flexAlignLeftCenter
    
    '...make headers bold
    For ctr = 0 To .Cols - 1
        For ctr2 = 0 To 2
            .Row = ctr2
            .Col = ctr
            .CellFontBold = True
        Next ctr2
    Next
    
    '...add headers
    .TextMatrix(2, 0) = "Date"
    .TextMatrix(2, 1) = "Venue"
    .TextMatrix(2, 2) = "Course"
    
     '...add month from Variable to merged cells
    For ctr = 0 To .Cols - 1
        For ctr2 = 0 To 1
            .TextMatrix(ctr2, ctr) = strCListMonth
        Next ctr2
    Next
    '...merge cells
    .MergeRow(1) = True
    .MergeCol(0) = True
    .MergeCol(1) = True
    .MergeCol(2) = True
    .MergeCells = flexMergeFree
    .Row = 1
    .CellAlignment = flexAlignCenterCenter
ScreenShot:




Edited by - andy99 on 3/21/2003 12:38:16 PM

Vb > Excel - Merge Cells
I am writing data to excel. I want a heading spread across a number of cells. Have tried to use what VBA code is created by running a macro. I've been able to select all relevant cells, but what next ?

Merge Cells In Excel
Hi Guys,

I am doing a report in VB which is supposed to be exported to Excel on the fly. I want to merge certain cells which is dynamic. How do i create a spreadsheetrange so as to merge the range of cells without displaying any message to the user.

Thanks.

Split Cells In Excel
Hello All

I am making a report in excel and am manipulating the first few rows for titles and details of the report.

I was wondering how would i be able to split 1 cell into 2 or 3

Reason I have a row of 7 columns and i want to create 3 equal coloumns so i merge the row into one cell


VB Code:
wSheet.Range("A4", "G4").Merge


then i want to split this new cell into 3 but i do not know the syntax.

Thanks.

Split One Cell Into Two Cells In Excel
Hi

How to split one single cell into two cells in excel 2003

Thanks

[VBScript] Excel Macro: Split String In Cells?
I have a list of names [First Last] in a column of Excel cells (A1 through A340 or so). The person who did the data entry was silly enough to put both first and last name in the same cell... it fell on me to write a script that would split them. Too bad I know no VBA, only VB.NET...

Example: Cell A1 has "John Smith". The macro needs to split it into A1 "John" and A2 "Smith", or A2 and A3, or whatever.

From VB experience, I know I should use a For loop to step through the string until I find a space, then chop and move... but can someone help me with appropriate commands for a VBScript macro?

Thanks,
Seth

Merge Cells Depending On Cells' Contents
I have two columns like

column D E

line 5 ABC 1
line 6 [empty] 2
line 7 [empty] 3
line 8 [empty] 4
line 9 ABC 1
line 10 [empty] 2
line 11 [empty] 3
....
line 60 ABC 1
line 61 [empty] 2
line 62 [empty] 3
line 63 [empty] [empty]
line 64 [empty] [empty]
....

I need to merge each cell containg text (ABC) with the empty cells below. My goal is to have some big cell with (ABC) in column D and all the cells with (1), (2), (3) in column E ... so that when I filter on column E, I don't loose the info on clumn D. (i.e. if I filter looking for (2) on column E, I will not be able to see the corresponding text (ABC) for each (2) value found by the filter)

Some facts:

* The number of empty cells below each text cell (ABC) is not constant - can be 0 as well as 100.
* The number of total text cells in column D is not constant.

My problem is that I do not know visual basic at all...
What I was thinking of in terms of algorithm is:

begin

variable CELL var1
variable CELL var2

var1 = D5
var2 = D6

while(var1 is not empty)
selection.add(var1)

while(var2 is empty)
selection.add(var2)
var2.move_one_cell_down()
end while

selection.merge

var1 = var2
var2.move_one_cell_down()

end while
end

Can it be translated into VB???

Thanks!
Edo

Excel And Vb , Reading Info From Cells Gives Me A Overflow Error [ Resolved]
this is the code i have :

VB Code:
Private Sub Form_Load()xlsfilename = App.Path & "small.xls"Set xlApp = New Excel.ApplicationxlApp.Workbooks.Open xlsfilenamexlApp.Worksheets("qrysmall").Activateacces.makeconnectionDoEvents For i = 2 To xlApp.ActiveCell.CurrentRegion.Rows.Count  acces.addrecord xlApp.ActiveSheet.Range("A" & i).Value, xlApp.ActiveSheet.Range("B" & i).Value, xlApp.ActiveSheet.Range("C" & i).Value, xlApp.ActiveSheet.Range("D" & i).Value, xlApp.ActiveSheet.Range("E" & i).Value  Me.Caption = i & " van de " & xlApp.ActiveCell.CurrentRegion.Rows.Count  Me.Show  DoEventsNext i MsgBox "Klaar met converteren."xlApp.Workbooks.CloseSet xlApp = Nothing  End Sub

acces.addrecord < with this sub i add the readed data into a recordset of a access file (it gives me a overflow error at the xlApp.ActiveSheet.Range("A" & i).Value

even after removing the items at row 67 it still gives me an overflow. how can i fix it? or what might be the problem?

Merge Cells
from vb6 etc... im trying to put text into
two cells using:

objWS.Cells(i, 4).Value = dat_range
objWS.Cells(i, 4).Merge (2)

dosent seem to work

also when i try to get help on any methods etc
i get error "cant find vbaxl8.hlp" where can i get
this file from?

anyone any ideas
many thanks

Merge Cells
Can someone tell me what is wrong with my code? I have used this code before in a differant app. But it is not working in this app. Can anyone see if I am doing something wrong? I'm trying to merge columns

Code:
For j = 0 To 5
With Form1.HBP1Grid(0)
.TextMatrix(0, j) = "Chest"
.MergeCol(j) = True
End With
With Form1.HBP1Grid(1)
.TextMatrix(0, j) = "Tricep"
.MergeCol(j) = True
End With
Next j

Merge Cells
Can anyone tell me why the first mergecell block of code does not merge the cells and the second mergecell block does?


Code:
ComGrid.MergeRow(0) = True
ComGrid.Row = 0
ComGrid.Col = 0
ComGrid.Text = "Tracker"
ComGrid.Col = 1
ComGrid.Text = "Tracker"
ComGrid.Col = 2
ComGrid.Text = "Tracker"
ComGrid.Col = 3
ComGrid.Text = "Tracker"

TrackGrid.MergeRow(0) = True
TrackGrid.Row = 0
TrackGrid.Col = 1
TrackGrid.Text = "Meal 1"
TrackGrid.Col = 2
TrackGrid.Text = "Meal 1"
TrackGrid.Col = 3
TrackGrid.Text = "Meal 1"
TrackGrid.Col = 4
TrackGrid.Text = "Meal 1"
TrackGrid.Col = 5
TrackGrid.Text = "Meal 2"
TrackGrid.Col = 6
TrackGrid.Text = "Meal 2"
TrackGrid.Col = 7
TrackGrid.Text = "Meal 2"
TrackGrid.Col = 8
TrackGrid.Text = "Meal 2"
TrackGrid.Col = 9
TrackGrid.Text = "Meal 3"
TrackGrid.Col = 10
TrackGrid.Text = "Meal 3"
TrackGrid.Col = 11
TrackGrid.Text = "Meal 3"

Merge Cells
does anyone know how to merge all the cells in alternating rows in a mshflexgrid control? i'd like to have one row have a couple word description, then the next row have individual numbers in separate cells, so that when a user clicks on a number i can open a seperate file.

Can I Merge Cells With Vsflexgrid?
Hello

My question is similiar to this one:
http://www.xtremevbtalk.com/show...grid.PrintGrid

Similiarly I have a flexgrid control populated with data and I would like to add a title spanning two columns. The answer given above mentions combining the vsFlexGrid with vsPrinter control from ComponentOne.

I am new to this and I would really appreciate if someone could let me know
a) is there anything like a colspan command for vsflexgrid without using vsPrinter?
b) if not then where do I start with vsPrinter from ComponentOne.

thank you
Gráinne

MSFlexgrid And Merge Cells
I'm not sure if this is the right forum but I'll try it anyway

I have a flexgrid in my latest project that I want ta appear in kind of the following way

________________________________
|_____________ |_________________|
|______|______ |________|________|
|______|______ |________|________|
|______|______ |________|________|
|______|______ |________|________|
|______|______ |________|________|

OK It's not extreme ascii art but it does the trick . The top row should be a merge of 2 or more columns and then the second row should be the colulns itself so you have this kind of subitems within the big items on the top row. (the first 2 rows would have to be fixed rows.

can anybody help me with this because I can't seem to figure out how to get the mergecells function to work.

thx a lot already

How To Merge Cells In A Mshflexgrid?
Hi Folks,
I have a MSHFlexgrid in which I have some cells that I would want to be merged. The problem is that the grid allows merging of adjacent cells only if their contents are same....For that, I inserted a blank space so that they merged together. But the thing is that I would want groups of cells to be merged.

As shown in the image, I would want 5 cells in the Stand Name column to be merged. Also, this grid is editable, which is messing up things even more.

I hope I conveyed my problem. Is there a way to do this?

Thanx in advance
Praveen

Insert Row + Merge Some Cells
I need to have a macro that:

1) inserts a row below the current row
2) applies the same borders to the same cells as the original row to the inserted row
3) merges D-G of the new row

Is this possible? I'm completely new to Excel VBA...sorry for the n00b question.

VB6 - Merge Cells In Spreadsheet
Hello all,
I am populating a spreadsheet with data from access file. I am splitting each record into two lines so that it writes on two lines(some of the records writes on one row and the other half writes on the next row. I am doing this because some of the length of the records are pretty long to fit on one line. However, data in the second row bunches up in the first cell(column A) and doesn't spread out, making the height of that row to be extremely large, disfiguring the look of the spreadsheet.

What code I use to expand that second row so that the records spread out to other unused cells?

This is the code that generates the record I need to spread out to other cells.

Code:
xlWksht.Cells(ii + 1, 1).value = "'" & rsin![Comments]

Below is the code that populates the spreadsheet:

Code:
Do Until rsin.EOF = True
ii = ii + 2
xlWksht.Cells(ii, 1).value = rsin![Req No]
xlWksht.Cells(ii, 2).value = rsin![Description]
xlWksht.Cells(ii, 3).value = rsin![P L] & Chr(10) & rsin![Pgmr2] & Chr(10) & rsin![Pgmr3]
xlWksht.Cells(ii, 4).value = rsin![ClientName] & Chr(10) & rsin![Status] xlWksht.Cells(ii, 5).value = "-" & Chr(10) & rsin![Per Hrs]
xlWksht.Cells(ii, 6).value = rsin![Hours] & Chr(10) & rsin![Tot Hrs] xlWksht.Cells(ii, 7).value = rsin![Start Date] & Chr(10) & rsin![Start Date]
xlWksht.Cells(ii, 8).value = rsin![End Date] & Chr(10) & rsin![End Date] xlWksht.Cells(ii + 1, 1).value = "'" & rsin![Comments]
rsin.MoveNext
Loop
tgifgemini

Msflexgrid Cells Merge
http://crypto.apiit.edu.my/cricket/file1.jpg
Look at the above ScreenShot. I want to Merge the Top 2 Rows Column. While i don't want to merge the rest of the column below it.

I want it something like this(below). Any idea appreciated.
http://crypto.apiit.edu.my/cricket/file2.jpg

Merge Cells In Msflexgrid
can any body help me that whenever i use msflexgrid.mergecells option the selection highlightning is set to invisible and i want it to be visible together with the mergecells option to be enabled....can anybody help me out in this case

VsFlexgrid Merge Cells
Hi

Could someone please help me with the merge cells feature on a
vsFlexgrid. I have adjusted the merge cells, merge cols and merge row
properties accordingly but no luck. I also want to know if it is
possible to put the cell merge in a border something like this < >

Many thanks

Merge Cells In Flexgrid
Hi
I want to write the same text into 2 cells in a Flexgrid,the length of the text is greater than the width of the column so I thought merging the 2 cells and thus being able to display the full text.
So How can I merge two cells vertically(e.g I want to merge cell(2,0) and cell(3,0)).
Is it possible that when I merge two cells vertically,to type the text(whose length is greater than the column width) in the mergedcell area?
thanks in advance

How To Merge 2 Cells In Msflexgrid
How to merge 2 cell in msflexgrid....Please help

Can't Get Cells To Merge Using FlexGrid
I am trying to merge 7 columns in a flexgrid and I can't get it to work. Here's my code:

Grid1.MergeCells = 1
Grid1.MergeCol(0) = True
Grid1.MergeCol(1) = True
Grid1.MergeCol(2) = True
Grid1.MergeCol(3) = True
Grid1.MergeCol(4) = True
Grid1.MergeCol(5) = True
Grid1.MergeCol(6) = True

Anyone have any ideas???

thanks!

Merge Cells In Flexgrid
Hey all.

I haven't tried this until now. can 4 cells be merged into one if they are two across and two down? That would be like cell (1,1)(1,2)(2,1)(2,2)

I haven't had any luck.


Anybody else?>

Thanks
Wengang

Merge Cells In The Flexgrid
How I merge the cells in the flexgrid ?

Merge Datagrid Cells
hi
i want to merge selected datagrid cells
is it possible

Merge Cells In Spreadsheet From Vb
I'm writing to a spreadsheet via vb.

How to merge several cells together???


thx a lot

grtz

Flexgrid Merge Cells When Adding Pic
Hi

I am using VsFlexgrid 8 and i want to store some small pictures in some of the cells but the problem is, is that some of the pics are a little bit to big so i need the pic to spill over into the next cell, it works great with text in the cells using the FlexMergeSpill property but it does not work for pictures, can someone please advise me.

Many thanks

Merge Cells And String Lengths
Hi,

I’ am working on a small programme that takes a string of text from a central source and inserts it into a merged cell.

I want to get the string length in points (I think), which takes account of the Font size and type.

This will allow me to set the row heights to fit the string in the merged cell.

There are macros that copy the value into a cell with the required length and then use excels autofit to determine the row height and then reset the sheet.

But is there a way to do what autofit does in VBA in a merge cell with out going through this routine as I have a large number of cells.

I how there is an example in API guide for GetTextExtentPoint32 however I can't figure out how to alter it to work with a selected range / merge cell as it is deigned for a form as opposed to a worksheet.

Any help will be much appreciated.

Thanks in advance

API Guide Code

Code:
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function ExtTextOut Lib "gdi32" Alias "ExtTextOutA" _
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal wOptions As Long, _
ByVal lpRect As Any, ByVal lpString As String, ByVal nCount As Long, lpDx As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function GetTextExtentPoint32 Lib "gdi32" Alias "GetTextExtentPoint32A" _
(ByVal hdc As Long, ByVal lpsz As String, ByVal cbString As Long, lpSize As POINTAPI) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'KPD-Team 1998
'URL: [url]http://www.allapi.net/[/url]
'E-Mail: [email]KPDTeam@Allapi.net[/email]
Dim Pt As POINTAPI, mWnd As Long, WR As RECT, nDC As Long
Dim TextSize As POINTAPI, CX As Long, CY As Long
'Get the current cursor position
GetCursorPos Pt
'Get the window under the cursor
mWnd = WindowFromPoint(Pt.X, Pt.Y)
'Get the window's position
GetWindowRect mWnd, WR
'Get the window'zs device context
nDC = GetWindowDC(mWnd)
'Get the height and width of our text
GetTextExtentPoint32 nDC, "Hello !", Len("Hello !"), TextSize
For CX = 1 To WR.Right - WR.Left Step TextSize.X
For CY = 1 To WR.Bottom - WR.Top Step TextSize.Y
'Draw the text on the window
ExtTextOut nDC, CX, CY, 0, ByVal 0&, "Hello !", Len("Hello !"), ByVal 0&
Next
Next
End Sub
Private Sub Form_Paint()
Me.CurrentX = 0
Me.CurrentY = 0
Me.Print "Click on this form," + vbCrLf + "Hold the mouse button," + vbCrLf + _
"drag the mouse over another window," + vbCrLf + "release the mouse button" + _
vbCrLf + "and see what happens!"
End Sub

Merge Cells And Wrap Text
I am trying to write a function that prints an Exel report based on info found in a database. I am having difficulties getting the text to fit into the cell though. No matter how big I make the cell (I know I'm doing something wrong, but I can't figure it out), Excel keeps returning "#VALUE" in the cell. Here is a small sample of code from the function. Thanks for your help in advance.

xlsObject.Application.Range("A" & Trim(Str(intCounter)), _
"J" & Trim(Str(intCounter + 3))).merge
xlsObject.Application.Range("A" & Trim(Str(intCounter))).Wraptext=True
xlsObject.Application.Range("A" & Trim(Str(intCounter))).Value = _
frmMain.adoMain.RecordSet.Fields("fldMemo")

I know it has something to do with the merge and/or wraptext functions I've used because a record from the database with a small amount of text in the fldMemo field displays in the report just fine.

Thanks again

Reply...Merge Cells In MSFlexgrid
if i use MSFlexGrid1.MergeCells = flexMergeFree in msflexgrid then the selection highlightning is hidden.....i am using this because i want to show dates on it and if i won't use it, it won't merge the cells. the dates at top of flexgrid will displayed in 3 rows.. in first row, like 2001, second january, last row 12 .....i want to use it and i also want the selection highlightning to be enabled.. if i use MSFlexGrid1.MergeCells =flexMergenever on mousedown then, all dates in the above rows & columns are messed up,, coz al of them merged.. i just want only 3 rows at top to no merge, but others won't at mouse down..
i am also attaching a sample form.. please check out.. and help me out... its urgent as well.. thanks in advance..
Anis

MSFlexGrid Merge Cells Question
I have a grid on my form that I merge Col(0) in groups of 3 rows. So every 3 rows will be merged. My question is, I thought cells would only merge if the data is the same in the cells that is suppose to merge. What is happening is if no data is being added to some of the cells all of the cells past that point merges together, even if no data is being added to those cells. Here is my code and a picture of what is happening.

Code:
If Form2.SCGrid.TextMatrix(2, 1) > "" Then
For j = 2 To 4
.MergeCells = flexMergeFree
.TextMatrix(j, 0) = Form2.SCGrid.TextMatrix(2, 1)
.MergeCol(0) = True
If Form2.SCGrid.TextMatrix(2, 2) = 3 Then
.TextMatrix(j, 2) = Form2.SCGrid.TextMatrix(2, 3)
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.8 / 5) * 5
.TextMatrix(3, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.9 / 5) * 5
.TextMatrix(4, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(3, 1) = "2"
.TextMatrix(4, 1) = "3"
.TextMatrix(2, 4) = "Warmup Set"
.TextMatrix(3, 4) = "Warmup Set"
.TextMatrix(4, 4) = "Power Set"
ElseIf Form2.SCGrid.TextMatrix(2, 2) = 2 Then
For i = 2 To 3
.TextMatrix(i, 2) = Form2.SCGrid.TextMatrix(2, 3)
Next i
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4) * 0.9 / 5) * 5
.TextMatrix(3, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(3, 1) = "2"
.TextMatrix(2, 4) = "Warmup Set"
.TextMatrix(3, 4) = "Power Set"
ElseIf Form2.SCGrid.TextMatrix(2, 2) = 1 Then
.TextMatrix(2, 2) = Form2.SCGrid.TextMatrix(2, 3)
.TextMatrix(2, 3) = Int(Form2.SCGrid.TextMatrix(2, 4))
.TextMatrix(2, 1) = "1"
.TextMatrix(2, 4) = "Power Set"
End If
Next j
End If
If Form2.SCGrid.TextMatrix(9, 1) > "" Then
For j = 5 To 7
.MergeCells = flexMergeFree
.TextMatrix(j, 0) = Form2.SCGrid.TextMatrix(9, 1)
.MergeCol(0) = True
If Form2.SCGrid.TextMatrix(9, 2) = 3 Then
.TextMatrix(j, 2) = Form2.SCGrid.TextMatrix(9, 3)
.TextMatrix(5, 3) = Int(Form2.SCGrid.TextMatrix(9, 4) * 0.8 / 5) * 5
.TextMatrix(6, 3) = Int(Form2.SCGrid.TextMatrix(9, 4) * 0.9 / 5) * 5
.TextMatrix(7, 3) = Int(Form2.SCGrid.TextMatrix(9, 4))
.TextMatrix(5, 1) = "1"

etc.

Can I Merge Cells (in MSFlexgrid) For Headings Only?
Hi,

I got the following code to merge and edit cells in MSFlexgrid. The problem is when I type in the same data in 2 consecutive rows (same column), data are also merged whereas I only want to merge cells for headings. Any idea of how to prevent this would be appreciated.


Code:
Private Sub Form_Load()

Text1.BorderStyle = vbBSNone
Text1.Visible = False

' Create grid
With MSFlexGrid1
.FixedCols = 0
.Cols = 8
.FixedRows = 2
.Rows = 20

.FormatString = "^Order No.|^Description|^Colour|^Size|^Size|^Size|^Qty|^Price|^Total"
.TextMatrix(1, 0) = "Order No."
.TextMatrix(1, 1) = "Description"
.TextMatrix(1, 2) = "Colour"
.TextMatrix(1, 3) = 5
.TextMatrix(1, 4) = 10
.TextMatrix(1, 5) = 15
.TextMatrix(1, 6) = "Qty"
.TextMatrix(1, 7) = "Price"
.TextMatrix(1, 8) = "Total"

'Merge cells (headings)
.MergeCells = flexMergeRestrictColumns
.MergeRow(0) = True
.MergeRow(1) = True
.MergeCol(0) = True
.MergeCol(1) = True
.MergeCol(2) = True
.MergeCol(3) = True
.MergeCol(4) = True
.MergeCol(5) = True
.MergeCol(6) = True
.MergeCol(7) = True
.MergeCol(8) = True
End With

End Sub

Private Sub MSFlexGrid1_Click()
If MSFlexGrid1.Row > 1 Then
GridEditText Asc(" ")
End If
End Sub
Private Sub GridEditText(ByVal KeyAscii As Integer)
' Position the TextBox over the cell.
Text1.Left = MSFlexGrid1.CellLeft + MSFlexGrid1.Left
Text1.Top = MSFlexGrid1.CellTop + MSFlexGrid1.Top
Text1.Width = MSFlexGrid1.CellWidth
Text1.Height = MSFlexGrid1.CellHeight
Text1.Visible = True
Text1.SetFocus

Select Case KeyAscii
Case 0 To Asc(" ")
Text1.Text = MSFlexGrid1.Text
Text1.SelStart = Len(Text1.Text)
Case Else
Text1.Text = Chr$(KeyAscii)
Text1.SelStart = 1
End Select
End Sub

Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
GridEditText KeyAscii
End Sub

Private Sub MSFlexGrid1_LeaveCell()
endedit
End Sub

Private Sub MSFlexGrid1_GotFocus()
endedit
End Sub

Private Sub endedit()
If Text1.Visible Then
MSFlexGrid1.Text = Text1.Text
Text1.Visible = False
End If
End Sub

Private Sub Text1_Change()
MSFlexGrid1.Text = Text1.Text
End Sub

How To Merge(Group) Cells In MSHflexgrid
Hi..

I want grouping of rows in MShflexgrid using mergecells poperty. like...my grid displays information about dispatches (disp number, Service,Courier,Weight,Price, cost,country,postcode,,date,etc..) Now i want to group rows which have same Service,courier and weight. IS anyone can help me out how to do this. I am stuck in middle of this.

Many Thanks
Nitesha

Flexgrid Merge Cells With Add Picture
Hi

I am using VsFlexgrid 8 and i want to store some small pictures in some of the cells but the problem is, is that some of the pics are a little bit to big so i need the pic to spill over into the next cell, it works great with text in the cells using the FlexMergeSpill property but it does not work for pictures, can someone please advise me.

Many thanks

MS Flex Grid Merge Cells
helooo
am using a Ms Flexgrid ,where in i do have 5 rows and 3 columnns
i now merge the first row , where all the cells are merged ,
the data is appears as a heading of the grid,
my problem is when i click on the merged cells, the data gets moved towards the left side.
how can i stop this?????
thanks in advance

Merge Cells In Flexgrid Control
Hi, I want to merge a certain range of cells in a flexgrid control, say from
0,0 to 1,10. Is that possible? The mergecells property seem confusing.

Thank you for any reply.

Merge Cells In Access Grid
Hi...

I ask your help for a VBscript problem... I wan to do a merge of cells in a grid component of MS Access...
Someone knows if is it possible?
Thanks
Cristiane

Merge Fixed Rows/cells Mshflexgrid
I have an MSHFlexgrid and I want to merge the top two rows. I don't want the rest of the data merged. I set up the merge with:


Code:
.MergeCells = flexMergeFree

.MergeRow(0) = True
.MergeRow(1) = True

For i = 0 To .Cols - 1
.MergeCol(i) = True
Next

But this is causing the entire thing to be merged. I just want my grid headers merged.....can someone help plz?

Merge Cells Problem In MSFlexGrid/VSFlexgrid
I want to Merge the Columns that have same data which are Merged in Rows Below.

http://crypto.apiit.edu.my/cricket/1a.jpg

The identical data is in in 2 different Cols, and when i Merge Columns then it dont Merge, acts as only Merge as Columns.

If i Merge Column on Top of While Merging Rows, it becomes like this..
http://crypto.apiit.edu.my/cricket/2a.jpg

While i want it to be Merged this way.. The Lines drawn on top of picture shows Columns...
http://crypto.apiit.edu.my/cricket/3a.jpg

Any Suggestion?

Can I Merge Cells In MSFlexGrid Without Merging Cols Below???
I want to merge som cells in my top row, in a flexgrid. How do I do that, without merging the columns below?


l--------------l
l--------------l
l--l--l--l--l--l--l
l--l--l--l--l--l--l
l--l--l--l--l--l--l
l--l--l--l--l--l--l
l--l--l--l--l--l--l

Have a nice weekend!

Steff

How To Merge Cells, Drag Drop Column
Hi everyone,

I read many mail about how to merge cells and move columns inside a Flex
Grid.

I'm sending this simple example to the one who needs to know how.

All you have to is to open a new exe project and add the FlexGrid Component
named by Fgrid and paste the code below.

Have a nice day everyone and take care







Dim MyValue As Integer

Dim OddOk As Boolean

Dim OddStr As String

Private Sub Form_Load()



Fgrid.Redraw = False



DoInitialSettings

FillGrid

Fgrid.Redraw = True





End Sub

Private Sub Fgrid_DragDrop(Source As VB.Control, X As Single, Y As Single)



If Fgrid.Tag = "" Then Exit Sub

Fgrid.Redraw = False

Fgrid.ColPosition(Val(Fgrid.Tag)) = Fgrid.MouseCol

Fgrid.Redraw = True



End Sub



Private Sub Fgrid_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)



Fgrid.Tag = ""

If Fgrid.MouseRow <> 0 Then Exit Sub

Fgrid.Tag = Str(Fgrid.MouseCol)

Fgrid.Drag 1



End Sub

Function FillGrid() As String



Dim I As Integer



For I = 0 To 10



DoEvents:



OddNo I

If OddOk = True Then MyValue = I + 1



Fgrid.AddItem I + 25 & Chr(9) & I + 75 & Chr(9) & "Test" & MyValue,
Fgrid.Rows - 1



Next I

Fgrid.RemoveItem (Fgrid.Rows - 1)



End Function



Sub DoInitialSettings()



Dim I

Fgrid.Row = 0

Fgrid.ColAlignment(0) = 7



For I = 0 To Fgrid.Cols - 1



Fgrid.Col = I

Fgrid.Text = "Col" & (I)

Fgrid.CellFontSize = 14

Fgrid.CellAlignment = 4



Fgrid.MergeCol(I) = True

Fgrid.ColWidth(I) = 2000

Next I



Fgrid.MergeCells = flexMergeRestrictColumns



End Sub

Function OddNo(OddNum As Integer)



OddStr = "0"

OddStr = InStr(1, Str(OddNum / 2), ".")



If OddStr = "0" Then

OddOk = False

Else

OddOk = True

End If



End Function







Best Regards,

_____



Ayman Mohammad Annan
Programmer & Technical Support
UNDP project at Ministry Of Foreign Affairs
Riyadh - Saudi Arabia

Office: +966 5 4055000 Ex 3651
Mobile: +966 5 9007577
E-mail 1: email@removed
E-mail 2: email@removed

_____

Is It Able To Merge Specific Cells Of Datagrid Control ?
dear all,
i wonder, is it able to merge cells of datagrid control ?
i am building an inventory application in vb6 with SQL Server as DBMS.
i want to deliver the data like this :

Code:

-------------------------------------------------------------
TransID | Customer | Products Bought |
-------------------------------------------------------------
T0001 | Jane | Sugar, Candy |
-----------------------------------------------
| John | Shoes, short, T Shirt |
-------------------------------------------------------------
T0002 | Mandy | Mouse, KeyBoard |
| | Memory, Processor |
-----------------------------------------------
| Jessica | Monitor, DVD, Speaker, |
| | SoundCard, VGA CArd |
------------------------------------------------
| Joan | Toshiba Laptop |
--------------------------------------------------------------
T0003 | Carrie | Groban VCD, Ball, Table |
-------------------------------------------------------------

is it possible to build such view using DataGrid ? or
maybe there is another way to build such this not using DataGrid ?

Thnx in advance

rgrds,

Szpilman

How To Merge Cells In ListView Control Like Grid
hi

i am using a listView control (in report view with grid lines) to display some records, in which the first column data is common for other columns data. so i need to merge the rows of first column for same record.

respons will be appriciated
thanx
keen

How To Merge Cells And Change Columns Color Of Flexgrid
Hi

1-Can anybody help me how to merge cells of a flexgrid. There is
property(flexgrid.mergecell) that is used to merge cells having identical
contents. But I need to merge coulmns before poulating it any value?

2-How to change color of grid columns?

3- If I change value of a cell then I want to recalculate the value of other
cell in the same row. How can I do that?

Regards
Saif

Urgent : How Do I Merge Cells In A Word Document Table Through VB Code
Hi

   I am working on VB6 where in i want to export the data from VB6 to a word document. I am facing with 2 problems

1. I actually want the text to come first and later the Table, but from my code, i am getting table first and later the text.

2. I want to merge 2nd and 3rd columns in first row and 4th and 5th columns in first row. How do i go about it.

   The table has to contain 5 columns. If i merge it is not accepting the next columns

Quote:
the code is as bellow

Private Sub Command1_Click()
    'Dim objword As Object
    Dim llRow As Long
    Dim llCol As Long
    Dim j As Integer
    
    Dim objword As Word.Application
    comdlgSaveas.Filter = ".doc"
    'Show the save dialog box
    comdlgSaveas.ShowSave
    sFilename = comdlgSaveas.FileName

    If Trim(sFilename) <> "" Then

    Set objword = CreateObject("Word.Application")
    Dim rng As Word.Range
    Dim myrange As Word.Range
With objword
    .Documents.Add
    .ActiveDocument.PageSetup.LeftMargin = 70
    .ActiveDocument.PageSetup.RightMargin = 70
    .ActiveDocument.PageSetup.TopMargin = 30
    
    Dim tbl As Word.Table
    Set rng = .Application.ActiveDocument.Paragraphs.Item(1).Range
    
    With .Application.ActiveDocument.Range
        .InsertBefore "Parent Name" & vbTab & txtParent.Text & vbCrLf
        .InsertBefore ("Location name:" & vbTab & txtLocation.Text & vbCrLf)
        .InsertBefore ("Census Year:" & vbTab & txtYear.Text & vbCrLf)
        .InsertBefore ("Crude Birth Rate :" & vbTab & txtCbr.Text & vbCrLf)
        .InsertBefore ("% Urban Population:" & vbTab & txtUrbanPer.Text & vbCrLf)
    End With
    Set rng = Nothing

    Dim rngs As Word.Range
    Set rngs = .Application.ActiveDocument.Paragraphs(1).Range

    With rngs
         Set tbl = .Application.ActiveDocument.Tables.Add(rngs, 24, 5)
        If .Application.ActiveDocument.Tables.Count >= 1 Then
        With .Application.ActiveDocument.Tables(1)
         .Rows(1).Shading.Texture = wdTexture10Percent
         .Columns(1).PreferredWidth = 50
         .AllowAutoFit = True
        
         .Cell(1, 2).Merge .Cell(1, 3)
         .Borders.Enable = False
         .Cell(1, 3).Merge .Cell(1, 4)
         .Borders.Enable = False
        End With
    End If
        
         For llRow = 1 To vsfgTotal.Rows
           For llCol = 1 To vsfgTotal.Cols
' If llRow = 1 And llCol = 3 Then
' .Application.ActiveDocument.Tables(1).Cell(1, 3).Merge (.Application.ActiveDocument.Tables(1).Cell(1, 2))
' .Application.ActiveDocument.Tables(1).Cell(1, 2).Range.InsertBefore (vsfgTotal.TextMatrix(0, 1))
' Exit For
' Else
' .Application.ActiveDocument.Tables(1).Cell(llRow, llCol).Range.InsertBefore (vsfgTotal.TextMatrix(llRow - 1, llCol - 1))
' End If
           Next
       Next
        
       End With
        .ActiveDocument.SaveAs sFilename
End With

     MsgBox "Profile Saved", vbInformation, Me.Caption
    objword.Documents.Close
    objword.Application.Quit
    Set objword = Nothing
    Set objApp = Nothing

    End If

End Sub

From the code if u can understand i want the Text part i.e., Parent name, location name etc. should come first and later the table but i am getting table first and later the text part


Do help me in this regard

Thanks in advance

bye

Quote:Thanks in advance

DHTML Edit Control-Split Cells
I got how to insert table and cells in DHTML edit control. How to split cells so that it span 2 rows.

Thanks

Barcode Split Input Into Three Access Cells
Using Wasp barcode wedge between keyboard and computer. Reading code 128 into cell.

Data is in NNNNDDAAAA formatt where
NNNN=4 charactor Customer ID
DD=2 char month
AAAA=4 char payment amount

I want to split incoming barcode data into these three fields automatically. Any help is appcriciated.

Looping Through Cells For Empty Cells Dynamically - Excel VBA - Need Help
Hi,
I need to run a SQL like 'Select * from xyz where xyz.column1 in {all entries from cell A1: A10}
The criteria here - cells in column A would be loaded dynamically and I would not know how many columns are there (it could be say, A1 to A10 or A1 to A 40). So basically I need to start at A1 , increment column by 1 and look for empty cells. When an empty cell is found, all values from A1 to the one before the empty cell would be included in the where query.
i would like to achieve this and would need your help in getting this done.
Thanks.
-VS

Copyright © 2005-08 www.BigResource.com, All rights reserved