Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2017, 04:45 AM
kgoosen kgoosen is offline Insert rows when column A data changes then shade and autosum blanks in columns E to I Windows 10 Insert rows when column A data changes then shade and autosum blanks in columns E to I Office 2016
Novice
Insert rows when column A data changes then shade and autosum blanks in columns E to I
 
Join Date: Aug 2017
Posts: 1
kgoosen is on a distinguished road
Default Insert rows when column A data changes then shade and autosum blanks in columns E to I

I currently have a macro which inserts a row whenever the data in column A changes. What I want to add is that it also shades and autosums columns E throught to I as well.

Could somebody please help me with this?

Here is the code that I am using to insert a row when the data in column A changes

Sub InsRowsWhenCellDataChangesColA()
Dim r As Long, mcol As String, i As Long

' find last used cell in Column A


r = Cells(Rows.Count, "A").End(xlUp).Row

' get value of last used cell in column A
mcol = Cells(r, 1).Value

' insert rows by looping from bottom
For i = r To 2 Step -1
If Cells(i, 1).Value <> mcol Then
mcol = Cells(i, 1).Value
Rows(i + 1).Insert
End If
Next i

End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert rows when column A data changes then shade and autosum blanks in columns E to I Parse data in one column to 3 other columns texascpa Excel 4 02-20-2017 04:53 AM
Insert rows when column A data changes then shade and autosum blanks in columns E to I Counting Blanks in 1 Column and Non-Blanks in Another dogwood705 Excel 4 02-07-2015 08:45 AM
Insert rows when column A data changes then shade and autosum blanks in columns E to I Insert values from multiple rows based on value in one column pachmarhi Excel 3 07-18-2014 09:57 PM
Insert rows when column A data changes then shade and autosum blanks in columns E to I Macro for Column to Rows Data brunssl2 Excel Programming 3 04-28-2014 07:07 AM
Insert rows when column A data changes then shade and autosum blanks in columns E to I Copying data from sheet with deleted columns creates blanks ZGreyArea Excel 1 11-20-2013 10:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft