OK Almost There VBA After inserting merged range I need to get value from cell below

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
So I am using this code to seperate my data so that each line with the sAME NAME IN COLUMN d ARE TOGETHER BUT A MERGED GROUP OF CELLS ARE INSERTED BEFORE EACH NEW NAME. aFTER THE CELLS ARE INSERTED THE ROW IS MODIFIED AND ALL WORKS PERFECT SO FAR.

What I'm still needing some help with is once I insert the cells and merge and format them I want to get the data from column D in the row below the new merged range and paste it in as Text in the new merged range.

Ideas?
Thanks in advance for any help or guidance.

Code:
Sub IRCV()

   Dim lRow As Long
   For lRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row To 3 Step -1
      If Cells(lRow, "D") <> Cells(lRow - 1, "D") Then Cells(lRow, 1).Resize(, 10).Select: Selection.Insert xlDown
      Selection.MergeCells = True
      
    With Selection.Interior
        .ThemeColor = xlThemeColorLight1
    End With
    With Selection.Font
        .Name = "3M Circular TT Bold"
        .Size = 12
        .ThemeColor = xlThemeColorDark1
    End With
      
   Next lRow
   
End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
.
Does this work ?

Code:
Option Explicit


Sub IRCV()


   Dim lRow As Long
   For lRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row To 3 Step -1
      If Cells(lRow, "D") <> Cells(lRow - 1, "D") Then Cells(lRow, 1).Resize(, 10).Select: Selection.Insert xlDown
      Selection.MergeCells = True
      Selection.Value = Cells(lRow - 1, "D").Value
      
      
    With Selection.Interior
        .ThemeColor = xlThemeColorLight1
    End With
    With Selection.Font
        .Name = "3M Circular TT Bold"
        .Size = 12
        .ThemeColor = xlThemeColorDark1
        .Color = RGB(255, 255, 255)
    End With
      
   Next lRow
   
End Sub
 
Upvote 0
Maybe
Code:
Sub IRCV()

   Dim lRow As Long
   For lRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row To 3 Step -1
      If Cells(lRow, "D") <> Cells(lRow - 1, "D") Then
         With Cells(lRow, 1).Resize(, 10)
            .Insert xlDown
            With .Offset(-1)
               .MergeCells = True
               .Value = Cells(lRow + 1, "D")
               .Interior.ThemeColor = xlThemeColorLight1
               With .Font
                  .Name = "3M Circular TT Bold"
                  .Size = 12
                  .ThemeColor = xlThemeColorDark1
               End With
            End With
         End With
      End If
   Next lRow

End Sub
 
Upvote 0
Fluff you are always awesome, thanks to all for the guidance.

Fluff, yours is cleaner than mine and I hope to one day operate at your level.

This is working perfectly now.
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0
.


[h=2]You Received An Answer - Now What ?[/h]
Whether the answer you receive solves your issue or it doesn't ... it is rude to ignore
those who volunteered to assist you.

Let the volunteers know if their assistance was successful or not. DO NOT simply 'walk
away' and not respond.

Participation in a FORUM is the same as having a face to face conversation. How would you
feel if the person you are having a conversation with suddenly walked away without saying
anything ?

Dude ... don't be rude.
 
Upvote 0
Fluff you are always awesome, thanks to all for the guidance.

Fluff, yours is cleaner than mine and I hope to one day operate at your level.

This is working perfectly now.

.


You Received An Answer - Now What ?

Whether the answer you receive solves your issue or it doesn't ... it is rude to ignore
those who volunteered to assist you.

Let the volunteers know if their assistance was successful or not. DO NOT simply 'walk
away' and not respond.

Participation in a FORUM is the same as having a face to face conversation. How would you
feel if the person you are having a conversation with suddenly walked away without saying
anything ?

Dude ... don't be rude.


Logit, If you read my response in line one I say "Thanks to all for guidance".........

Not sure what else you'd have been looking for but,

Thanks Logit for offering guidance I appreciate you taking time to offer assistance and guidance in my search for the solution. You have helped me in the past and I appreciate you.:beerchug:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top