ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   [VBA] pb with "group" method (https://www.excelbanter.com/excel-programming/369372-%5Bvba%5D-pb-group-method.html)

argv

[VBA] pb with "group" method
 

Hi everyone,

I'm trying to developp a VBA code which will group a range of columns
together "dynamically", but I have a pb ! Here the code :

Code:
--------------------
Sub Group(iNumSheet, iColumnsDeb)
For IColumns = iColumnsDeb To iColumnsDeb + 200
If xlapp.ActiveWorkbook.Sheets(iNumSheet).Cells(7, IColumns).Font.Bold = True And xlapp.ActiveWorkbook.Sheets(iNumSheet).Cells(7, IColumns).Font.Italic = True Then
xlapp.ActiveWorkbook.Sheets(iNumSheet).Range(Cells (7, iColumnsDeb), Cells(7, IColumns - 1)).Columns.Group
End If
Next
End Sub
--------------------


I try to execute once, it's working, yeah !
But a seconde time does not work : I have this pb :
"The cells method of the object '_globals' failed".
Do you have any idea of what's goin' on ?
Thank you

PS : sorry for my english (I'm French !)


--
argv
------------------------------------------------------------------------
argv's Profile: http://www.excelforum.com/member.php...o&userid=37099
View this thread: http://www.excelforum.com/showthread...hreadid=568269



All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com