View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Merge cells with C/C++?

Please ignore - this was a response to another post.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Try it this way:

Private Sub ComboBox1_Change()
'this works
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
UserForm1.TextBox1.Value = Cells(iRow, 1).Value
UserForm1.TextBox2.Value = Cells(iRow, 2).Value
UserForm1.TextBox3.Value = Cells(iRow, 3).Value
UserForm1.TextBox4.Value = Cells(iRow, 4).Value
UserForm1.TextBox5.Value = Cells(iRow, 5).Value

End Sub

Private Sub CommandButton1_Click()
'this does not work, only the first gets updated
Dim iRow As Integer
iRow = ComboBox1.ListIndex + 1
Sheets("sheet1").Cells(iRow, 1).Value = UserForm1.TextBox1.Value
'none of these below update the sheet
Sheets("sheet1").Cells(iRow, 2).Value = UserForm1.TextBox2.Value
Sheets("sheet1").Cells(iRow, 3).Value = UserForm1.TextBox3.Value
Sheets("sheet1").Cells(iRow, 4).Value = UserForm1.TextBox4.Value
Sheets("sheet1").Cells(iRow, 5).Value = UserForm1.TextBox5.Value
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

Private Sub CommandButton2_Click()
'just a cancel button to exit out
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
ComboBox1.List = sheets("Sheet1").Range("a1:e40").Value
End Sub

--
Regards,
Tom Ogilvy


"Jerry" wrote in message
...
I have been in a process of rewriting all my VBA code to C++ to create a

XLL
file. for increased speed and security. The problem I have come across

is
the
process of merging cells together. Can someone direct me in the right
direction on how to do this. This is not a COM it is a XLL file and

using
Excel4 for macro calls. As there is very little information out there on
working on things like this I have been unable to figure out how to do

this.

If anyone knows how to do this or has a sample they could put up it

would
be
greatly appreciated. Thanks in advance