Macro to Convert

deepakga123

Board Regular
Joined
Jan 5, 2012
Messages
51
Hi Team,

Appreciate your help here
I need macro to convert below data in column A into column B, I have huge data like this which I do manually

Image1.PNG
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
How about
VBA Code:
Sub deepakga()
   With Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row)
      .Value = Evaluate(Replace("text(replace(@,1,find("" "",@),"""")&year(today()),""00 0000"")", "@", .Offset(, -1).Address))
   End With
End Sub
 
Upvote 0
How about
VBA Code:
Sub deepakga()
   With Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row)
      .Value = Evaluate(Replace("text(replace(@,1,find("" "",@),"""")&year(today()),""00 0000"")", "@", .Offset(, -1).Address))
   End With
End Sub
Thank You very much Fluff,
It is working same as I wanted :)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
Assuming your week numbers are 1 or 2 digits long, here is another (slightly more compact) macro that you can consider...
VBA Code:
Sub deepakga123()
  Dim LastRow As Long
  LastRow = Cells(Rows.Count, "A").End(xlUp).Row
  Range("B2:B" & LastRow) = Evaluate("TEXT(RIGHT(A2:A" & LastRow & ",2)&YEAR(NOW()),""00 0000"")")
End Sub
 
Last edited:
Upvote 0
Assuming your week numbers are 1 or 2 digits long, here is another (slightly more compact) macro that you can consider...
VBA Code:
Sub deepakga123()
  Dim LastRow As Long
  LastRow = Cells(Rows.Count, "A").End(xlUp).Row
  Range("B2:B" & LastRow) = Evaluate("TEXT(RIGHT(A2:A" & LastRow & ",2)&YEAR(NOW()),""00 0000"")")
End Sub
Thanks Rick appreciate you help here, Code is working as i wanted
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,655
Members
449,113
Latest member
Hochanz

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