How to find the days difference between two dates [closed]

Instead of using vba just enter the formula for the first row on C1 : =ROUND(a1,0)-ROUND(b1,0) Then just the formula to the end of exisiting rows. If you insist using vba code use the simple code below: Dim LastRow As Long LastRow = ActiveSheet.Range(“A” & Rows.Count).End(xlUp).Row Range(“c1”).Select ActiveCell.FormulaR1C1 = “=ROUND(RC[-1],0)-ROUND(RC[-2],0)” Range(“c1”).AutoFill Destination:=Range(“C1:C” & LastRow) End … Read more

How to convert to percentage [closed]

Perhaps the following VBA solution using Regular Expressions. Function FixMyPercentages(target As String) As String Dim output As String output = target With New RegExp .Global = False .MultiLine = True .IgnoreCase = False .pattern = “\s\d+\.\d+$|^\d+\.\d+\s|\s\d+\.\d+\s” Dim myMatch As Object, myMatches As Object Do While .test(output) Set myMatches = .Execute(output) For Each myMatch In myMatches … Read more

Want to concatenate multiple row data in in cell along with its values if present. Emp Id should not come if no data available infromt of it

Using TEXTJOIN would be the easiest way, but if you wanted you can also use a VBA code. Function Concat(rng As Range, Optional sep As String = “https://stackoverflow.com/”) As String Dim rngCell As Range Dim strResult As String For Each rngCell In rng If rngCell.Value <> “” Then strResult = strResult & sep & rngCell.Value … Read more

using for loop for vba

Can you please try this? Idea would be something like this. Dim FileNo As String For i = 1 To 35 FileNo = “File” & i Windows(FileNo).Activate ‘Rest of the code Next