Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Problems with numeric formatting in cells

Hi Folks:

I can't figure this one out. I'm writing a macro that counts the
frequencies of certain values (similar to a frequency distribution) for
a range of data. So, in my routine I have the line:

Cells(i + 1, 7) = (i - 1) * var1 + Start & " - " & i * var1 + Start - 1

which should give me, in cell(i + 1, 7), for example:

6 - 10

except I'm getting:

Jun-10

Does anyone know how to set the format of cell(i + 1, 7) to "General" or
string, or something other than a date, in the code of the macro?

Thanks,

Matt Andrzejewski

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Problems with numeric formatting in cells

One way:

With Cells(i + 1, 7)
.NumberFormat = "@"
.Value = (i - 1) * var1 + Start & " - " & i * var1 + Start - 1
End with

which changes cell format to Text. Another:

Cells(i + 1, 7).Value = "'" & (i - 1) * var1 + Start & " - " & _
i * var1 + Start - 1

which leaves the cell number format alone


In article ,
Matt Andrzejewski wrote:

Hi Folks:

I can't figure this one out. I'm writing a macro that counts the
frequencies of certain values (similar to a frequency distribution) for
a range of data. So, in my routine I have the line:

Cells(i + 1, 7) = (i - 1) * var1 + Start & " - " & i * var1 + Start - 1

which should give me, in cell(i + 1, 7), for example:

6 - 10

except I'm getting:

Jun-10

Does anyone know how to set the format of cell(i + 1, 7) to "General" or
string, or something other than a date, in the code of the macro?

Thanks,

Matt Andrzejewski

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--
Email address ROT-13'd for spam reduction
see www.mcgimpsey.com/excel/groupspam.html to decode
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Problems with numeric formatting in cells

Matt,

One of 2 ways:
1. Preformat the cell as Text (or use code)
2. Cells(1,1) = "'" & 6 & " - " & 10
this puts a leading apostrophy in front of the value and Excel sees
it as text.
--
sb
"Matt Andrzejewski" wrote in message
...
Hi Folks:

I can't figure this one out. I'm writing a macro that counts the
frequencies of certain values (similar to a frequency distribution) for
a range of data. So, in my routine I have the line:

Cells(i + 1, 7) = (i - 1) * var1 + Start & " - " & i * var1 + Start - 1

which should give me, in cell(i + 1, 7), for example:

6 - 10

except I'm getting:

Jun-10

Does anyone know how to set the format of cell(i + 1, 7) to "General" or
string, or something other than a date, in the code of the macro?

Thanks,

Matt Andrzejewski

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
Problems with numeric key pad sld1947 Excel Discussion (Misc queries) 1 January 9th 10 08:20 PM
Another numeric formatting anomaly JoeU2004 Excel Discussion (Misc queries) 0 October 17th 09 06:47 AM
Numeric formatting JudgeMental Excel Discussion (Misc queries) 6 May 10th 08 10:19 PM
numeric value is not formatting correctly Fam via OfficeKB.com Excel Discussion (Misc queries) 4 February 2nd 06 04:20 PM
Numeric formatting problem Metolius Dad Excel Worksheet Functions 3 May 22nd 05 07:14 PM


All times are GMT +1. The time now is 10:34 AM.

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"