[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Re: send range results to a certian cell

Gord Dibben

12/18/2006 9:29:00 PM

walt

Looks like the code is missing an "End Sub"(no quotes)

Add after the last End If

You could use basically the same code but have it run automatically when you
change the value in A1

Private Sub Worksheet_Change(ByVal Target As Range)
v = Range("A1").Value

If v > 500 And v < 1001 Then
Range("C4").Value = v
End If

If v > 1000 And v < 25001 Then
Range("C5").Value = v
End If

If v > 25000 And v < 100001 Then
Range("C6").Value = v
End If

End Sub


This is sheet event code.

Right-click on the sheet tab and "View Code"

Copy/paste the above into that sheet module.

Enter a number in A1 and see what happens.


Gord Dibben MS Excel MVP

On Mon, 18 Dec 2006 12:20:00 -0800, walt <walt@discussions.microsoft.com> wrote:

>Hi, I tried this and I got an "end" error I am not very good with the macros
>anf I may be doing something wrong , Could you be a litter more "step BY step"
>
>Thanks
>walt
>
>
>"Gary''s Student" wrote:
>
>> Enter this macro:
>>
>> Sub deal_it()
>> v = Range("A1").Value
>>
>> If v > 500 And v < 1001 Then
>> Range("C4").Value = v
>> End If
>>
>> If v > 1000 And v < 25001 Then
>> Range("C5").Value = v
>> End If
>>
>> If v > 25000 And v < 100001 Then
>> Range("C6").Value = v
>> End If
>>
>> then enter a value in cell A1 and run the macro.
>> --
>> Gary's Student
>>
>>
>> "walt" wrote:
>>
>> > I would like to send certian range numbers to a specific cell from a single
>> > cell such as
>> >
>> > you would enter the number in a1
>> > if the number is 501-1000 it would go yo c4
>> > if the number is 1001-25000 it would go yo c5
>> > if the number is 25001-100000 it would go yo c6
>> >
>> > and so on

1 Answer

Walt

12/19/2006 6:44:00 PM

0

thanks this worked great untill I saved it. System administrator has
unsigned macros blocked. I have to get with him to get this fixed. But the
page works perfect

thanks again


"Gord Dibben" wrote:

> walt
>
> Looks like the code is missing an "End Sub"(no quotes)
>
> Add after the last End If
>
> You could use basically the same code but have it run automatically when you
> change the value in A1
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> v = Range("A1").Value
>
> If v > 500 And v < 1001 Then
> Range("C4").Value = v
> End If
>
> If v > 1000 And v < 25001 Then
> Range("C5").Value = v
> End If
>
> If v > 25000 And v < 100001 Then
> Range("C6").Value = v
> End If
>
> End Sub
>
>
> This is sheet event code.
>
> Right-click on the sheet tab and "View Code"
>
> Copy/paste the above into that sheet module.
>
> Enter a number in A1 and see what happens.
>
>
> Gord Dibben MS Excel MVP
>
> On Mon, 18 Dec 2006 12:20:00 -0800, walt <walt@discussions.microsoft.com> wrote:
>
> >Hi, I tried this and I got an "end" error I am not very good with the macros
> >anf I may be doing something wrong , Could you be a litter more "step BY step"
> >
> >Thanks
> >walt
> >
> >
> >"Gary''s Student" wrote:
> >
> >> Enter this macro:
> >>
> >> Sub deal_it()
> >> v = Range("A1").Value
> >>
> >> If v > 500 And v < 1001 Then
> >> Range("C4").Value = v
> >> End If
> >>
> >> If v > 1000 And v < 25001 Then
> >> Range("C5").Value = v
> >> End If
> >>
> >> If v > 25000 And v < 100001 Then
> >> Range("C6").Value = v
> >> End If
> >>
> >> then enter a value in cell A1 and run the macro.
> >> --
> >> Gary's Student
> >>
> >>
> >> "walt" wrote:
> >>
> >> > I would like to send certian range numbers to a specific cell from a single
> >> > cell such as
> >> >
> >> > you would enter the number in a1
> >> > if the number is 501-1000 it would go yo c4
> >> > if the number is 1001-25000 it would go yo c5
> >> > if the number is 25001-100000 it would go yo c6
> >> >
> >> > and so on
>
>