Alternative Loop

kermitfrog123

Board Regular
Joined
Dec 19, 2015
Messages
50
Hi All,

I have the below VBA code which does what I need but it is very slow. Can someone tell me if there is a way this can be done in one step rather than looping through all 2500 cells.

Code:
    Application.ScreenUpdating = False

    Dim Current_Date As Date
    Dim Date_String As String
    
    Dim rCell As Range
    Dim rRng As Range


    Set rRng = Range("F3:F2500")


    For Each rCell In rRng.Cells
        
    rCell.Select
    Date_String = rCell.Value
    Current_Date = CDate(Date_String)
    rCell.Select
    rCell.Value = Current_Date
    
    Next rCell


    Application.ScreenUpdating = True
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
If you are just converting text dates to real dates use text to columns & on page 3 select date
 
Upvote 0
Im not sure I understand. On Page 3 ??
Step 3 of the Text to Columns Wizard.

I think I understand what you meant now. Can I do this within a Macro ?
One way is to turn on the Macro Recorder and record yourself doing it manually.
It will give the VBA code needed to do that.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,312
Members
452,634
Latest member
cpostell

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