Hijra Date into Gregorian

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Sorry, I don't know how to convert all cells at once without a macro. This worked for me:

Code:
Sub Test()
    Dim Rng As Range
    Dim Cell As Range
    Set Rng = Range("A1").SpecialCells(xlCellTypeConstants, 2)
    For Each Cell In Rng.Cells
        If Cell.Value Like "##/##/####" Then
            SendKeys "{F2}{HOME}a{ENTER}"
            Cell.Select
            DoEvents
        End If
    Next Cell
End Sub

Andrew can i ask you ?
1) why use ==> For Each Cell In Rng.Cells not ===> For Each Cell In Rng without .Cells
2) what is this command mean DoEvents

I'm sorry for my intervention
 
Upvote 0
<table border="0" cellpadding="0" cellspacing="0" width="333"><col style="width: 64pt;" width="85"> <col style="width: 98pt;" width="130"> <col style="width: 89pt;" width="118"> <tbody><tr style="height: 39pt;" height="52"> <td class="xl68" style="height: 39pt; width: 64pt;" align="left" height="52" width="85">31/04/1428</td> <td style="width: 98pt;" align="center" width="130">FALSE</td> <td class="xl70" style="width: 89pt;" align="center" width="118">#VALUE!</td> </tr> <tr style="height: 38.25pt;" height="51"> <td class="xl68" style="height: 38.25pt; border-top: medium none;" align="left" height="51">24/05/1426</td> <td align="center">FALSE</td> <td class="xl70" align="right">01-07-05</td> </tr> </tbody></table>
 
Upvote 0
Andrew can i ask you ?
1) why use ==> For Each Cell In Rng.Cells not ===> For Each Cell In Rng without .Cells
2) what is this command mean DoEvents

I'm sorry for my intervention

1) Just to be explicit. It works without it.
2) DoEvents passes control to the operating system. Control is returned after the operating system has finished processing the events in its queue and all keys in the SendKeys queue have been sent. Without it Sendkeys isn't processed.
 
Upvote 0

Forum statistics

Threads
1,224,846
Messages
6,181,304
Members
453,031
Latest member
Chris_1

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