Convert excel macro from date cell to custom number

Gabriel Rotar

New Member
Joined
Mar 5, 2021
Messages
7
Office Version
  1. 2013
Platform
  1. Windows
Hello,

I need generated a new macro from an existing one that is set to convert a certain cell into a desired date, but now I need to adapt the same code to update another cell to a special number format ex. "14.23"
Can somebody help me with the adjustments that I have to make on below code to be able to fill in the above values like?
There is that IsDate, CDate & DateValue to replace, but I need more deeper research then available time...
Thank you in advance!

Sub Bulk_Update_RequiredVersion()

Dim mbox As Variant
Dim num As Double
Dim folder_path As String

Dim wb As Workbook
Dim ws As Worksheet

Do
mbox = InputBox("Enter New Required Version", "Enter Number")
If StrPtr(mbox) = 0 Then Exit Sub

If IsDate(mbox) Then
txtRequire = CDate(mbox)
Else
MsgBox "The entered number is not valid"
End If

Loop Until IsDate(mbox)
num = DateValue(mbox)
folder_path = "D:\PLs"
my_files = Dir(folder_path & "\*.xlsx")

Do While my_files <> ""

Set wb = Workbooks.Open(folder_path & "\" & my_files)

Sheets("Product Line Information").Select

Cells.Find(What:="Required Version", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Cells.End(xlToRight).Select
ActiveCell = num

Range("A1").Select
Application.DisplayAlerts = False
ActiveWorkbook.RemovePersonalInformation = False
wb.Close True
my_files = Dir()
Loop
MsgBox ("All Files are Updated")
End Sub
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,214,646
Messages
6,120,715
Members
448,985
Latest member
chocbudda

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