vba help - Fill Blank cells of above date

Mallesh23

Well-known Member
Joined
Feb 4, 2009
Messages
983
Office Version
  1. 2010
Platform
  1. Windows
Hi Team,

Need VBA help to fill dates in Blank cells of Column A.

Expected Output shown in Column D. thanks in advance for your help.

Below is data with Expected Output.

Book1
ABCDE
1DateCompanyDateCompany
205/10/2020ABC05/10/2020ABC
3Agst Ref05/10/2020Agst Ref
4XXX05/10/2020XXX
508/10/2020XYZ08/10/2020XYZ
6ABC08/10/2020ABC
7XXX08/10/2020XXX
812/10/2020PQR12/10/2020PQR
9Agst Ref12/10/2020Agst Ref
10XXX12/10/2020XXX
11XXX12/10/2020XXX
12XXX12/10/2020XXX
13XXX12/10/2020XXX
14XXX12/10/2020XXX
15XXX12/10/2020XXX
16XXX12/10/2020XXX
1713/10/2020RST13/10/2020RST
18xxx13/10/2020xxx
19xxx13/10/2020xxx
20xxx13/10/2020xxx
2123/10/2020DEF23/10/2020DEF
22Agst Ref23/10/2020Agst Ref
23Agst Ref23/10/2020Agst Ref
24Agst Ref23/10/2020Agst Ref
Sheet1



Thanks
mg
 
With the data in your last post what does the formula
Excel Formula:
=CODE(A8)
return?
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi Mark,

Perfect ! Thanks for your help, Macro is giving correct Output now .

I extract this dump from Tally software.

Can you tell me what was the issue and how you sorted it.



Thanks
mg
 
Upvote 0
My last post shouldn't have sorted anything, the last post that should have altered anything was post 7 that you stated didn't change the formulas in E?
 
Upvote 0
Hi Mark,,

Few cells issue got sorted, there are few blanks cells Trim and Fill Blank macro,
didn't worked on those cells. Actually I pasted data from Different input files. I Don't remember.

One of data data it worked.

Below is the Break up of Input data.... and its output after formula and after macro.

also not getting values when applied formula, formula is automatic.calculation
=LEN(A2)
=LEN(A2)
=LEN(A2)
=LEN(A2)

Book8
ABCDEF
1DateParticularBefore trim FORMULA IS Blank OutputBefore Running any Macro Formula CodeAfter Running Trim MacroFinal Output on Date Column
201/09/2020xyzFALSE52FALSE01/09/2020
3xyzTRUE#VALUE!TRUE01/09/2020
4xyzTRUE#VALUE!TRUE01/09/2020
5xyzTRUE#VALUE!TRUE01/09/2020
6xyzTRUE#VALUE!TRUE01/09/2020
7xyzFALSE#VALUE!FALSEStill issue here
801/09/2020xyzFALSE52FALSE01/09/2020
9xyzTRUE#VALUE!TRUE01/09/2020
10xyzFALSE#VALUE!FALSEStill issue here
1101/09/2020xyzFALSE52FALSE01/09/2020
12xyzFALSE#VALUE!FALSEStill issue here
1301/09/2020xyzFALSE52FALSE01/09/2020
14xyzTRUE#VALUE!TRUE01/09/2020
15xyzFALSE#VALUE!FALSEStill issue here
16xyzFALSE#VALUE!FALSEStill issue here
17xyzTRUE#VALUE!TRUEStill issue here
Sheet8
Cell Formulas
RangeFormula
D2:D17D2=CODE(A2)
E2:E17E2=ISBLANK(A2)


Thanks
mg
 
Last edited:
Upvote 0
If you click on A7 what (if anything) appears in the formula bar?
 
Upvote 0
Hi Mark,

In formula bar it is not showing anything,
with open eyes its blank cell
if clicked on that cell ... numberformat shows text
Applied len formula it shows 0 values.

then afterwords through loop, I did cleared Contents for 0 lengths cells,

Macro is giving correct output

VBA Code:
For i = 2 To 485
    If Len(Cells(i, 1).Value) = 0 Then
        Cells(i, 1).ClearContents
    End If
Next i

    On Error Resume Next
    With Range("A2:A" & Range("B" & Rows.Count).End(xlUp).Row)
        .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
        .Value = .Value
    End With

Thanks
mg
 
Upvote 0
Happy that you got it sorted, you probably had one of the less common non-printing characters in there. That is one of the problems with downloading from the web you do tend to get these characters dragged in (most commonly character 160 but the code would have taken care of that one).

If you get the same issue again then there is some other code we can try.
 
Upvote 0
Hi Mark,

Can you share alternative code to handle it. I just got this project still not delivered.
When Macro delivered for testing user might identify it. if available please share else I will continue this existing.



Thanks
mg
 
Upvote 0
If you have some raw data upload the file to a free file hosting site like www.box.com or www.dropbox.com, mark it for sharing and post the link it provides in the thread and I will test the code.

Make sure that you amend any sensitive data before uploading the file.
 
Upvote 0
Hi Mark,

Thanks for your help and patience, I am unable to upload it. But
Will use existing code which you have provided, which is working at the moment. if any issue arises will use fresh thread. (y)?



Thanks
mg
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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