Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel change value

Hi,

In the Excel 2000, I have a Worksheet like this

1 1 John
2 0 Mary
3 1 Tom
4 0 Jane
5 0 Helen

How do I do to let the data change to

1 M John
2 F Mary
3 M Tom
4 F Jane
5 F Helen

Thanks for help.

Jason



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Excel change value

public sub test()

dim sze as Long
sze = Sheets("Data").Cells(rows.count, 1).End(xlUp).row
dim i as long
for i = 1 to sze
if sheets("Data").Cells(i, 1).value = 1 then
sheets("Data").cells(i, 1).Value = "Male"
else
sheets("Data").Cells(i, 1).Value = "Female"
end if
next i
end sub

This should do the trick, copy and paste the code into a module. This checks
a sheet called Data, then firstly assignes the variable sze with the amount
of rows in the sheet.

Then proceeds to go through each row checking Column A (which contains
either 0 or 1) and makes the neccessary change.

Haven't had time to test this, but should work.

Hope that helps! :)
"Jason Huang" wrote:

Hi,

In the Excel 2000, I have a Worksheet like this

1 1 John
2 0 Mary
3 1 Tom
4 0 Jane
5 0 Helen

How do I do to let the data change to

1 M John
2 F Mary
3 M Tom
4 F Jane
5 F Helen

Thanks for help.

Jason




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel change value

Select the column with the 1's and 0's in it and click on Edit/Replace in
Excel's menu bar. Put 1 in the "Find what" field and M in the "Replace with"
field and click on the Replace All button; then do the same for 0 and F.

Rick


"Jason Huang" wrote in message
...
Hi,

In the Excel 2000, I have a Worksheet like this

1 1 John
2 0 Mary
3 1 Tom
4 0 Jane
5 0 Helen

How do I do to let the data change to

1 M John
2 F Mary
3 M Tom
4 F Jane
5 F Helen

Thanks for help.

Jason




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
Excel graphs change when pasted into Publisher - Metafiles change? Ericd1 Charts and Charting in Excel 0 February 1st 10 01:57 AM
How to trigger one cell change to change another cell using VB in excel? Please help! :) raytan Excel Programming 4 March 26th 07 03:49 AM
Excel bar chart formatting of bars to change colors as data change JudyT Excel Discussion (Misc queries) 1 January 24th 07 06:07 PM
Excel change tracking. Need to reverse a rejected change mcw Excel Discussion (Misc queries) 0 October 11th 06 07:53 PM
excel deleting rows last cell does not change. How to change? mrubey Excel Discussion (Misc queries) 3 August 25th 05 08:38 PM


All times are GMT +1. The time now is 05:44 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"