#1   Report Post  
Brent E
 
Posts: n/a
Default 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.
  #2   Report Post  
JE McGimpsey
 
Posts: n/a
Default

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.

  #3   Report Post  
Brent E
 
Posts: n/a
Default

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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Another Friday Question Jeremy Excel Worksheet Functions 2 March 23rd 05 09:08 AM
Question about combining data from multiple workbooks into one rep BookOpenandUpright Excel Discussion (Misc queries) 2 February 19th 05 12:37 PM
An easy macro question and one I believe to be a little more diffi TroutKing Excel Worksheet Functions 3 January 18th 05 09:17 PM
2 part question on averaging Geo Excel Discussion (Misc queries) 4 January 2nd 05 10:35 PM


All times are GMT +1. The time now is 09:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"