Results 1 to 4 of 4

Thread: [RESOLVED] Merged Cells

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    233

    Resolved [RESOLVED] Merged Cells

    hi guys, is there a way to check in vba to count how many rows has been merged in a particular column?
    let's say in column A i merged rows 1 to 10, by clicking that particular merged cells rows 1 to 10 on the left will be highlighted so user will know that 10 rows has been merged..but to do this in a macro is there a way to count those rows that has been merged? any ideas is greatly appreciated..
    The taller the bamboo grows the lower it bends...

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Merged Cells

    vb Code:
    1. Private Sub MergedCellsRowsCount()
    2.     Dim strAddress As String, MyArray() As String
    3.        
    4.     strAddress = Selection.Address
    5.    
    6.     '~~> Check if cells are merged
    7.     If Selection.MergeCells Then
    8.         If InStr(1, strAddress, ":") > 0 Then
    9.             MyArray = Split(strAddress, ":")
    10.            
    11.             '~~> Display the number of rows in the Range
    12.             MsgBox "The Selected range has " & _
    13.             Range(MyArray(1)).Row - Range(MyArray(0)).Row & " merged Rows"
    14.         Else
    15.             MsgBox "Please select a Merged Cell"
    16.         End If
    17.     Else
    18.             MsgBox "Please select a Merged Cell"
    19.     End If
    20. End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    233

    Re: Merged Cells

    thanks.Koolsid
    The taller the bamboo grows the lower it bends...

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: [RESOLVED] Merged Cells

    Glad to be of help
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width