Convert all cells in a column from hrs into mins

  • Thread starter Thread starter TroyB
  • Start date Start date
T

TroyB

Hi,

I'm trying to convert all the cells in a column from hrs to mins. I've
writting the below email but it only converts all the numbers into 0 (zero).
What is wrong with the below macro? Is there an easier code?
Note: The info in the spreadsheet has been inserted from a *.csv file.
Could this be the problem?

Thank you for your assistance.
Regards
Troy

Sub HrsToMins()

Dim wkb As Workbook, i As Long, lngLastRow As Long, sht As Worksheet
Dim Hrs As Integer, Min As Integer

With ActiveSheet
lngLastRow = .Cells(Rows.Count, 19).End(xlUp).Row

For i = 20 To lngLastRow
Cells(i, 19).Value = Hrs
Min = Hrs * 60
Cells(i, 19).Value = Min
Next

End With
End Sub
 
Hi Troy

You never assign anything to Hrs, so zero it is. Modify to

For i = 20 To lngLastRow
Hrs = Cells(i, 19).Value
Min = Hrs * 60
Cells(i, 19).Value = Min
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top