Add blank cell after each Sunday

Vishaal

Active Member
Joined
Mar 16, 2019
Messages
434
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
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,592
Office Version
  1. 365
Platform
  1. Windows
Are the dates and days you show hard-coded, or formulas?
What columns is this data in?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,592
Office Version
  1. 365
Platform
  1. Windows
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
 

Vishaal

Active Member
Joined
Mar 16, 2019
Messages
434
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Thanks Joe4, its working in my case

many thanks bro
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,592
Office Version
  1. 365
Platform
  1. Windows
You are welcome.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,387
Messages
5,624,389
Members
416,026
Latest member
melvic69

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
Top