Add blank cell after each Sunday

Vishaal

Well-known Member
Joined
Mar 16, 2019
Messages
533
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
HI,

thanks

we want to add blank cell after each sunday, help pls

DateWeek
01-Jan-19Tuesday
02-Jan-19Wednesday
03-Jan-19Thursday
04-Jan-19Friday
05-Jan-19Saturday
06-Jan-19Sunday
07-Jan-19Monday
08-Jan-19Tuesday
09-Jan-19Wednesday
10-Jan-19Thursday
11-Jan-19Friday
12-Jan-19Saturday
13-Jan-19Sunday


any code or vba
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Are the dates and days you show hard-coded, or formulas?
What columns is this data in?
 
Upvote 0
This should do what you want:
VBA Code:
Sub MyInsertRows()

    Dim r As Long, lr As Long
   
    Application.ScreenUpdating = False
   
'   Find last row with data in column B
    lr = Cells(Rows.Count, "B").End(xlUp).Row
   
'   Loop through all rows from bottom to top
    For r = lr To 2 Step -1
        If Cells(r, "B") = "Sunday" Then Rows(r + 1).Insert
    Next r
   
    Application.ScreenUpdating = True

End Sub
 
Upvote 0
Thanks Joe4, its working in my case

many thanks bro
 
Upvote 0

Forum statistics

Threads
1,214,883
Messages
6,122,077
Members
449,064
Latest member
MattDRT

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