ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   send range results to a certian cell (https://www.excelbanter.com/excel-programming/379639-re-send-range-results-certian-cell.html)

Gord Dibben

send range results to a certian cell
 
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 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




All times are GMT +1. The time now is 07:59 PM.

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