LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Changing numbers to characters by using range values

Hi now I faced a new problem:

I wanted to make the following system

If in Column A values a

Value=0 ,will be changed to N
Value 0 and < 2 will be changed to V
Value 2 and < 5 will be changed to F

Here is my code

'Here is determined stone/gravel abundance sbhm_stgr/sbhe_stgr

Dim grv As Long
Application.ScreenUpdating = False

For grv = 1 To Worksheets("Horizon_Measurements").Cells(Rows.Coun t
"S").End(xlUp).Row
If (Cells(grv, "S").Value) = 0 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "N"
ElseIf Worksheets("Horizon_Measurements").Cells(grv, "S").Value
< 2 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "C"
ElseIf Worksheets("Horizon_Measurements").Cells(grv, "S").Value
< 5 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "F"
ElseIf Worksheets("Horizon_Measurements").Cells(grv, "S").Value
< 15 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "C"
ElseIf Worksheets("Horizon_Measurements").Cells(grv, "S").Value
15 < 40 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "M"
ElseIf Worksheets("Horizon_Measurements").Cells(grv, "S").Value
40 < 90 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "A"
ElseIf Worksheets("Horizon_Measurements").Cells(grv, "S").Value
90 Then
Worksheets("Horizon_Measurements").Cells(grv, "S").Value = "D"
End If


Next grv


This code produces characters but not correctly, for example if I pu
the value 91 to cell S2 the macro gives letter C instead of letter D
My code works somehow, but not properly, what i'am doing wrong

--
Message posted from http://www.ExcelForum.com

 
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
Average a changing range of values Richard New Users to Excel 2 October 2nd 09 08:31 AM
Changing numerical values based upper and lower range jrmcosmo Excel Discussion (Misc queries) 4 September 22nd 09 04:58 PM
Changing column headers from alphabetical characters to numbers? dylan Excel Discussion (Misc queries) 2 July 24th 08 04:27 PM
Filling in a table with changing range values bunky2000 Excel Discussion (Misc queries) 1 May 28th 08 12:04 PM
how to format only specific characters or numbers within each cellwithin a range of cells Colleen Excel Discussion (Misc queries) 4 September 12th 05 10:04 PM


All times are GMT +1. The time now is 12:04 PM.

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

About Us

"It's about Microsoft Excel"