ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value NOT adding 1 ?? (https://www.excelbanter.com/excel-programming/383367-value-not-adding-1-a.html)

Corey

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....



Gary''s Student

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....




dkinn

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....




Tom Ogilvy

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....





Corey

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....






Dave Peterson

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

Corey

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....







Tom Ogilvy

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....









Corey

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....










Tom Ogilvy

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....












Dave Peterson

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



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com