Sub RoundAmounts()
Dim rngA As Range
Dim rngJ As Range
Dim cell As Range
' Set the range for column A
Set rngA = ThisWorkbook.Sheets("Sheet2").Range("A2:A" & ThisWorkbook.Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row)
' Set the range for column J
Set rngJ = ThisWorkbook.Sheets("Sheet2").Range("J2:J" & ThisWorkbook.Sheets("Sheet2").Cells(Rows.Count, "J").End(xlUp).Row)
' Loop through each cell in column A
For Each cell In rngA
' Round the value to remove the decimal part
cell.Value = Round(cell.Value, 0)
Next cell
' Loop through each cell in column J
For Each cell In rngJ
' Round the value to remove the decimal part
cell.Value = Round(cell.Value, 0)
Next cell
End Sub
Sub macrochangecolumnformat()
' Column A
Columns("A:A").Select
With Selection
.NumberFormat = "General"
.Value = .Value
For Each cell In Selection
If IsNumeric(cell.Value) Then
cell.Value = Int(cell.Value)
End If
Next cell
End With
' Column J
Columns("J:J").Select
With Selection
.NumberFormat = "General"
.Value = .Value
For Each cell In Selection
If IsNumeric(cell.Value) Then
cell.Value = Int(cell.Value)
End If
Next cell
End With
End Sub
Sub macrochangecolumnformat()
Dim lastRowA As Long, lastRowJ As Long
Dim cell As Range
Dim ws As Worksheet
' Set the worksheet
Set ws = ThisWorkbook.Sheets("Sheet2") ' Change "Sheet1" to your sheet name
' Find the last row with data in column A
lastRowA = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
' Find the last row with data in column J
lastRowJ = ws.Cells(ws.Rows.Count, "J").End(xlUp).Row
' Loop through each row with data in column A
For Each cell In ws.Range("A1:J" & lastRowA)
If IsNumeric(cell.Value) Then
cell.Value = Round(cell.Value, 0)
End If
Next cell
' Loop through each row with data in column J
End Sub