Macro to delete cells

Status
Not open for further replies.

edwardj3

New Member
Joined
Jan 16, 2018
Messages
41
Office Version
  1. 365
Platform
  1. Windows
Hi,

Can you suggest any VBA code which will delete the cells with no data entries. I also want it to remove the 24 x hourly periods plus the date cell which is 24 merged cells. I hope you can copy and paste sp you can see the formatting.

Period 1 could have a min of 3 days of data (6 empty days to be deleted) and a maximum of 9 days of data (no data to be deleted.

As is

Period 1Web TransactionsMetric ID01/01/201802/01/201803/01/201804/01/201805/01/201808/11/201709/11/201710/11/201701/01/2016
24-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-2424-11-22-33-44-55-66-77-88-99-1010-1111-1212-1313-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-24
Service11.0000.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.02.61.91.51.51.61.51.61.42.23.80.80.00.00.00.00.00.00.00.00.00.00.00.03.22.22.01.61.61.61.71.71.612.41.10.00.00.00.00.00.00.02.30.00.00.00.00.03.21.91.61.51.51.31.41.61.51.71.20.00.00.00.00.00.00.00.00.00.00.00.00.01.71.71.41.41.41.41.41.51.51.53.30.00.00.00.00.0
Service22.0002.13.940.82.92.51.87.52.91.92.22.32.02.12.22.32.62.91.31.82.34.52.23.73.41.92.44.13.55.26.37.03.11.21.21.21.41.31.31.51.61.81.72.02.32.12.02.72.52.43.65.84.73.03.66.33.81.01.01.41.21.11.01.31.51.91.82.00.81.92.14.41.92.33.15.55.52.92.16.92.20.91.01.11.20.91.11.31.51.72.41.91.72.22.33.62.42.11.92.311.65.12.64.72.61.00.80.91.11.41.41.41.71.72.92.02.32.63.01.71.3
Service33.0002.43.125.93.02.32.27.63.81.51.71.72.21.52.42.21.41.92.12.32.03.61.64.72.73.44.33.65.25.83.66.12.81.71.22.02.22.22.61.92.62.42.61.81.72.12.23.23.13.25.23.57.64.25.43.77.51.51.51.71.61.81.61.41.62.337.62.32.32.22.26.32.22.56.44.08.76.52.64.63.41.61.71.92.11.61.31.52.42.41.82.32.02.62.72.72.42.64.03.28.77.23.45.53.91.81.51.71.51.52.22.31.82.32.12.22.62.02.33.22.4
Service44.0000.00.00.00.00.00.00.00.00.00.00.00.00.00.00.61.20.50.00.00.00.00.00.01.00.00.00.00.00.00.00.02.60.70.60.90.70.91.00.81.00.60.01.20.00.00.00.00.00.00.00.00.00.00.00.044.20.90.70.90.51.00.90.51.30.50.80.01.30.00.00.00.00.00.00.00.00.00.00.00.00.71.00.91.01.11.01.21.00.60.71.00.00.00.00.80.00.00.00.00.00.00.00.40.00.50.80.90.81.10.90.80.80.30.90.40.00.00.60.00.0
Service55.0000.00.00.06.90.00.00.03.60.02.82.12.52.12.12.02.12.31.82.21.92.32.52.82.22.40.01.62.80.02.97.82.82.02.02.22.22.62.72.83.02.51.52.32.03.52.921.52.70.03.40.00.00.03.79.312.12.32.42.32.62.22.92.42.92.42.52.52.02.12.24.32.53.110.30.07.05.22.617.42.11.92.22.22.32.62.42.32.92.32.02.31.93.02.13.02.62.82.60.00.00.02.711.53.22.21.92.02.22.52.32.32.42.02.71.82.32.72.02.72.7
Service66.0000.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.00.01.91.31.41.51.51.71.71.61.81.61.30.00.00.00.00.00.00.00.00.00.00.00.00.01.91.41.61.61.71.61.61.51.91.70.00.00.00.00.00.00.00.00.00.00.00.00.00.00.01.41.51.51.61.71.61.51.91.90.00.00.00.00.00.00.00.00.00.00.00.00.00.01.91.51.31.51.51.51.61.51.71.70.00.00.00.00.00.00.0
Service77.0000.00.00.00.00.00.00.00.00.01.40.00.00.80.01.00.00.00.00.00.00.00.00.00.00.01.65.72.911.11.82.61.70.80.90.70.80.80.90.80.91.01.01.11.21.81.01.61.50.02.69.26.12.72.09.95.10.70.80.70.70.70.80.70.91.11.21.21.11.30.83.40.61.11.46.010.62.91.02.61.20.80.80.70.70.70.70.70.91.00.91.31.41.61.24.32.01.41.62.26.51.81.43.42.60.80.70.80.70.80.80.71.01.11.31.21.41.60.011.50.9
Service88.0000.00.00.00.00.00.00.00.01.60.90.70.80.80.90.70.50.70.60.90.00.40.01.50.00.00.00.00.00.00.00.01.00.80.80.80.70.70.70.70.70.60.70.70.60.83.00.00.00.00.00.00.00.00.00.00.01.70.80.90.80.70.70.70.80.71.20.80.60.90.80.00.00.00.00.00.00.00.00.02.30.90.80.80.70.80.70.80.80.70.70.60.70.90.00.00.00.00.00.00.00.00.08.31.41.10.80.80.70.70.80.70.80.80.80.90.81.01.21.50.0
Service99.0000.00.00.00.00.00.00.02.80.70.60.50.50.50.50.50.50.60.40.40.00.70.50.00.00.00.00.00.00.00.05.60.60.50.50.80.80.80.60.50.50.50.50.50.50.82.80.00.00.00.00.00.00.00.019.90.01.00.50.60.50.50.50.50.60.50.90.60.50.70.70.80.00.00.00.00.00.00.07.71.10.80.50.50.50.50.50.50.60.50.50.50.50.60.50.00.00.00.00.00.00.00.00.02.70.80.50.50.50.50.50.50.50.50.60.50.51.20.40.90.0

<tbody>
</tbody>


To be
Period 1Web TransactionsMetric ID01/01/201802/01/201803/01/201804/01/201805/01/2018
##################06-Jul##################13-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-24#########################################13-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-24######################################13-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-24#######################################13-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-24#######################################13-1414-1515-1616-1717-1818-1919-2020-2121-2222-2323-24
Service110000000000000000000000000000000002.61.91.51.51.61.51.61.42.23.80.80000000000003.22.221.61.61.61.71.71.612.41.100000002.3000003.21.91.61.51.51.31.41.61.51.71.200000000000001.71.71.41.41.41.41.41.51.51.53.300000
Service222.13.940.82.92.51.87.52.91.92.22.322.12.22.32.62.91.31.82.34.52.23.73.41.92.44.13.55.26.373.11.21.21.21.41.31.31.51.61.81.722.32.122.72.52.43.65.84.733.66.33.8111.41.21.111.31.51.91.820.81.92.14.41.92.33.15.55.52.92.16.92.20.911.11.20.91.11.31.51.72.41.91.72.22.33.62.42.11.92.311.65.12.64.72.610.80.91.11.41.41.41.71.72.922.32.631.71.3
Service332.43.125.932.32.27.63.81.51.71.72.21.52.42.21.41.92.12.323.61.64.72.73.44.33.65.25.83.66.12.81.71.222.22.22.61.92.62.42.61.81.72.12.23.23.13.25.23.57.64.25.43.77.51.51.51.71.61.81.61.41.62.337.62.32.32.22.26.32.22.56.448.76.52.64.63.41.61.71.92.11.61.31.52.42.41.82.322.62.72.72.42.643.28.77.23.45.53.91.81.51.71.51.52.22.31.82.32.12.22.622.33.22.4
Service44000000000000000.61.20.5000000100000002.60.70.60.90.70.910.810.601.200000000000044.20.90.70.90.510.90.51.30.50.801.30000000000000.710.911.111.210.60.710000.800000000.400.50.80.90.81.10.90.80.80.30.90.4000.600
Service550006.90003.602.82.12.52.12.122.12.31.82.21.92.32.52.82.22.401.62.802.97.82.8222.22.22.62.72.832.51.52.323.52.921.52.703.40003.79.312.12.32.42.32.62.22.92.42.92.42.52.522.12.24.32.53.110.3075.22.617.42.11.92.22.22.32.62.42.32.92.322.31.932.132.62.82.60002.711.53.22.21.922.22.52.32.32.422.71.82.32.722.72.7
Service6600000000000000000000000000000001.91.31.41.51.51.71.71.61.81.61.300000000000001.91.41.61.61.71.61.61.51.91.70000000000000001.41.51.51.61.71.61.51.91.9000000000000001.91.51.31.51.51.51.61.51.71.70000000
Service770000000001.4000.80100000000001.65.72.911.11.82.61.70.80.90.70.80.80.90.80.9111.11.21.811.61.502.69.26.12.729.95.10.70.80.70.70.70.80.70.91.11.21.21.11.30.83.40.61.11.4610.62.912.61.20.80.80.70.70.70.70.70.910.91.31.41.61.24.321.41.62.26.51.81.43.42.60.80.70.80.70.80.80.711.11.31.21.41.6011.50.9
Service88000000001.60.90.70.80.80.90.70.50.70.60.900.401.50000000010.80.80.80.70.70.70.70.70.60.70.70.60.8300000000001.70.80.90.80.70.70.70.80.71.20.80.60.90.80000000002.30.90.80.80.70.80.70.80.80.70.70.60.70.90000000008.31.41.10.80.80.70.70.80.70.80.80.80.90.811.21.50
Service9900000002.80.70.60.50.50.50.50.50.50.60.40.400.70.5000000005.60.60.50.50.80.80.80.60.50.50.50.50.50.50.82.80000000019.9010.50.60.50.50.50.50.60.50.90.60.50.70.70.800000007.71.10.80.50.50.50.50.50.50.60.50.50.50.50.60.50000000002.70.80.50.50.50.50.50.50.50.50.60.50.51.20.40.90

<tbody>
</tbody>
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Duplicate: https://www.mrexcel.com/forum/excel-questions/1039659-vba-delete-cells.html

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note: If you are trying to test out different posting tools, please use the "Test Here" forum for that purpose, and then you can post back to your original thread when you have it worked out.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,724
Messages
6,126,482
Members
449,316
Latest member
sravya

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