ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA Question (https://www.excelbanter.com/excel-discussion-misc-queries/29639-vba-question.html)

Brent E

VBA Question
 
I need to know what VBA code to use to write a procedure that will do these
steps:

Look at each cell on the worksheet from (row1, col2) to (endrow, endcol.)
If a cell is blank, leave the cell blank.
If a cell is not blank, convert that cell to a number, or do a paste special
to multiply that cell times the number 1 placed in a spare blank cell on the
spreadsheet.

Thanks.

JE McGimpsey

One way:

Public Sub ConvertToValues()
On Error Resume Next
With ActiveSheet
With Intersect(.Range("B:IV"), .UsedRange)
With Union(.SpecialCells(xlCellTypeConstants, _
xlTextValues), .SpecialCells( _
xlCellTypeFormulas, xlNumbers))
.Value = .Value
End With
End With
End With
On Error GoTo 0
End Sub


In article ,
"Brent E" wrote:

I need to know what VBA code to use to write a procedure that will do these
steps:

Look at each cell on the worksheet from (row1, col2) to (endrow, endcol.)
If a cell is blank, leave the cell blank.
If a cell is not blank, convert that cell to a number, or do a paste special
to multiply that cell times the number 1 placed in a spare blank cell on the
spreadsheet.

Thanks.


Brent E

Magnificent. I appreciate your assistance, JE.

"JE McGimpsey" wrote:

One way:

Public Sub ConvertToValues()
On Error Resume Next
With ActiveSheet
With Intersect(.Range("B:IV"), .UsedRange)
With Union(.SpecialCells(xlCellTypeConstants, _
xlTextValues), .SpecialCells( _
xlCellTypeFormulas, xlNumbers))
.Value = .Value
End With
End With
End With
On Error GoTo 0
End Sub


In article ,
"Brent E" wrote:

I need to know what VBA code to use to write a procedure that will do these
steps:

Look at each cell on the worksheet from (row1, col2) to (endrow, endcol.)
If a cell is blank, leave the cell blank.
If a cell is not blank, convert that cell to a number, or do a paste special
to multiply that cell times the number 1 placed in a spare blank cell on the
spreadsheet.

Thanks.




All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com