Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT adding 1 ??

TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Value NOT adding 1 ??

No problem in you line of code. This works just fine:

Sub hyui()
v = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1
MsgBox (v)
End Sub

--
Gary's Student
gsnu200706


"Corey" wrote:

TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Value NOT adding 1 ??

Works fine for me too.

David

"Gary''s Student" wrote:

No problem in you line of code. This works just fine:

Sub hyui()
v = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1
MsgBox (v)
End Sub

--
Gary's Student
gsnu200706


"Corey" wrote:

TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Value NOT adding 1 ??

try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 1)

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT adding 1 ??

Thanks Tom, but i seem to STILL get ONLY the MAX value.
If i do this:
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 2)
then i get the MAX + 1 ????

"Tom Ogilvy" wrote in message ...
try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 1)

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Value NOT adding 1 ??

If you put
=max(a:a)
in an empty cell on the Data sheet, what do you see?

Any chance that the thing that looks like the max is really not a number--it's
text?

Corey wrote:

Thanks Tom, but i seem to STILL get ONLY the MAX value.
If i do this:
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 2)
then i get the MAX + 1 ????

"Tom Ogilvy" wrote in message ...
try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 1)

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....



--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT adding 1 ??

Found out why.
I was adding the "A" and i have the Data Adding it also.

Now i need to remove the "A" when it is placed in the Data Sheet leaving ONLY the Numerical value.
EG.
"A 1234" to be "1234" how do i do that ?

"Corey" wrote in message ...
Thanks Tom, but i seem to STILL get ONLY the MAX value.
If i do this:
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 2)
then i get the MAX + 1 ????

"Tom Ogilvy" wrote in message ...
try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 1)

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Value NOT adding 1 ??

How are you putting the value in the cell. If by a link, do it with code
instead.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
Found out why.
I was adding the "A" and i have the Data Adding it also.

Now i need to remove the "A" when it is placed in the Data Sheet leaving
ONLY the Numerical value.
EG.
"A 1234" to be "1234" how do i do that ?

"Corey" wrote in message
...
Thanks Tom, but i seem to STILL get ONLY the MAX value.
If i do this:
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 2)
then i get the MAX + 1 ????

"Tom Ogilvy" wrote in message
...
try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 1)

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Value NOT adding 1 ??

I am using code like :
Range("A1").Value = TextBox1.Value
"Tom Ogilvy" wrote in message ...
How are you putting the value in the cell. If by a link, do it with code
instead.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
Found out why.
I was adding the "A" and i have the Data Adding it also.

Now i need to remove the "A" when it is placed in the Data Sheet leaving
ONLY the Numerical value.
EG.
"A 1234" to be "1234" how do i do that ?

"Corey" wrote in message
...
Thanks Tom, but i seem to STILL get ONLY the MAX value.
If i do this:
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 2)
then i get the MAX + 1 ????

"Tom Ogilvy" wrote in message
...
try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) + 1)

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Value NOT adding 1 ??

So instead of

Range("A1").Value = TextBox1.Value

do

Range("A1").Value = Application.Max(Sheets("Data").Range("A:A")) + 1


Reminds me of the old joke

Patient: Doc, it hurts when I do this!
Doctor: Don't do that.

But maybe I am missing something <g

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
I am using code like :
Range("A1").Value = TextBox1.Value
"Tom Ogilvy" wrote in message
...
How are you putting the value in the cell. If by a link, do it with code
instead.

--
Regards,
Tom Ogilvy


"Corey" wrote in message
...
Found out why.
I was adding the "A" and i have the Data Adding it also.

Now i need to remove the "A" when it is placed in the Data Sheet leaving
ONLY the Numerical value.
EG.
"A 1234" to be "1234" how do i do that ?

"Corey" wrote in message
...
Thanks Tom, but i seem to STILL get ONLY the MAX value.
If i do this:
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) +
2)
then i get the MAX + 1 ????

"Tom Ogilvy" wrote in message
...
try
TextBox1.Value = "A " & (Application.Max(Sheets("Data").Range("A:A")) +
1)

--
Regards,
Tom Ogilvy



"Corey" wrote in message
...
TextBox1.Value = "A " & Application.Max(Sheets("Data").Range("A:A")) + 1

The result of the above is EQUAL to the MAX value and NOT (+1) Why?

I get "A 3869" instead of "A3870".

Corey....













  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Value NOT adding 1 ??

Dr: Please go to the window and stick your tongue out and say ahhhhhhhh.
Patient: Why?
Dr. I don't like the guy across the street.



Tom Ogilvy wrote:
<<snipped
Reminds me of the old joke

Patient: Doc, it hurts when I do this!
Doctor: Don't do that.

But maybe I am missing something <g

--
Regards,
Tom Ogilvy

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
Adding Dig Excel Discussion (Misc queries) 3 August 19th 08 12:35 AM
Adding Sarah_Lecturer Excel Discussion (Misc queries) 2 April 17th 08 01:46 PM
Adding every 5th row (e.g. B5 + B10 + B15 etc) Shazzer Excel Discussion (Misc queries) 6 December 20th 06 08:00 PM
adding A.S. Excel Discussion (Misc queries) 1 December 6th 06 09:35 PM
Adding with & Jim Excel Worksheet Functions 3 February 4th 05 03:30 AM


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

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"