Date formatting setting blank cells to (blank) in pivot

JamesW

Well-known Member
Joined
Oct 30, 2009
Messages
1,197
Hi guys,

I am using the following code which sort of works fine:

Code:
With Range("F2:F" & Cells(Rows.Count, "F").End(xlUp).Row)
   varDates = .Value
   For lngIndex = LBound(varDates) To UBound(varDates)
      If Len(varDates(lngIndex, 1)) > 0 Then varDates(lngIndex, 1) = (Replace(varDates(lngIndex, 1), ".", "/"))
   Next lngIndex
   .NumberFormat = "dd/mm/yyyy"
   .Value = varDates
End With
The problem is that I need to pivot the data and then sort the pivot by date descending.

This all works fine, however the blank cells (there is a blank cell for each set of dates) are showing as "(blank)" in my pivot, and not just blank (""), therefore when I come to do the sort it is putting "(blank)" first, which is ****ing up my vlookup.

I assume this is because the blank cells are also being changed to date format, but may be mistaken.

Is there anything I can change in my code?

Cheers,

James
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Do you actually need the blank cells displayed?
 
Upvote 0
No, and I've just figured it out (I hid them in the pivot).

Thanks for all your help Rory.
 
Upvote 0

Forum statistics

Threads
1,224,621
Messages
6,179,937
Members
452,949
Latest member
beartooth91

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