Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change the Value of cell to Whole Number


How do I change the value of a cell to a whole number? The closest
thing I can find on the net is int and it says to do like so
int(C1)
So I tried to program that in to my loop where i is equal to the row
number
int("C" & i)
and it says to me
"Compile Error: Expected Identifier"

I'm not even sure if int is what I want to do because after doing
further research on it, it seems that int causes the value to round
down. So a value of 210.832169 will be 210 instead of 211. Anyone
have any insight on what I can search for?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=471437

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Change the Value of cell to Whole Number

Range("A1").Value = CInt(Range("A1").Value)
--
HTH...

Jim Thomlinson


"DKY" wrote:


How do I change the value of a cell to a whole number? The closest
thing I can find on the net is int and it says to do like so
int(C1)
So I tried to program that in to my loop where i is equal to the row
number
int("C" & i)
and it says to me
"Compile Error: Expected Identifier"

I'm not even sure if int is what I want to do because after doing
further research on it, it seems that int causes the value to round
down. So a value of 210.832169 will be 210 instead of 211. Anyone
have any insight on what I can search for?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=471437


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Change the Value of cell to Whole Number

The error is coming because you are not setting anything equal to int("C" &
i) and you also need to specify (in VBA) that this is a Range address.
Finally, the function you want is Round()
Round(number,decimals) rounds the number to the specified number of
decimals; 0 for a whole number
Range("C" & i).Value = Round(Range("C"&i).Value,0)
--
- K Dales


"DKY" wrote:


How do I change the value of a cell to a whole number? The closest
thing I can find on the net is int and it says to do like so
int(C1)
So I tried to program that in to my loop where i is equal to the row
number
int("C" & i)
and it says to me
"Compile Error: Expected Identifier"

I'm not even sure if int is what I want to do because after doing
further research on it, it seems that int causes the value to round
down. So a value of 210.832169 will be 210 instead of 211. Anyone
have any insight on what I can search for?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=471437


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change the Value of cell to Whole Number


So, what's the difference between Int and CInt?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=471437

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
How do I change the number of characters per cell? Lenoch Setting up and Configuration of Excel 4 February 8th 06 08:40 PM
How do I change a number in one cell to change a series of cells? lance559 Excel Discussion (Misc queries) 2 January 13th 06 08:56 PM
how can I enter a 21 digit number in a cell & keep it from change alex Excel Discussion (Misc queries) 2 November 4th 05 10:24 PM
How do I change a number in a cell without effecting the formula? Celeste Excel Discussion (Misc queries) 2 October 22nd 05 11:40 PM
how change number in cell to text Marcelo Excel Discussion (Misc queries) 2 July 13th 05 02:18 PM


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