ajaypal_sp
New Member
- Joined
- Feb 11, 2015
- Messages
- 25
HI
I wrote a VBA code by using Sumifs function. in this code i find out starting column number (for each category box), ending column number based on merged cells. by using #selection.columns.count# . sometimes this formula returns 1 even though there are 6 cells in Mergearea. When we run the code by using F5, this line of code is not working properly. Please help me.
in my code the below part is not working properly. i used below code 10 times in VBA module.
Here,
sc - start column
n - no of cells in merge area.
ec - end column
Thank you in advance.
Regards
shiva
I wrote a VBA code by using Sumifs function. in this code i find out starting column number (for each category box), ending column number based on merged cells. by using #selection.columns.count# . sometimes this formula returns 1 even though there are 6 cells in Mergearea. When we run the code by using F5, this line of code is not working properly. Please help me.
in my code the below part is not working properly. i used below code 10 times in VBA module.
Code:
With ThisWorkbook.Worksheets("ks sales").Range("a2:az2")
Set sc = .Find("BYOD TRANSACTIONS")
If Not sc Is Nothing Then
sc = sc.Column
n = [COLOR=#0000cd][B]Cells(2, sc).MergeArea.Columns.Count[/B][/COLOR]
ec = n + sc - 1
End If
End With
Here,
sc - start column
n - no of cells in merge area.
ec - end column
Thank you in advance.
Regards
shiva
Last edited: