Automatically create list in different sheet on basis of other lis

  • Thread starter Thread starter Pair_of_Scissors
  • Start date Start date
P

Pair_of_Scissors

Is it possible to create a new list based on the contents of the values in
the first sheet?

I have a list in the first sheet of my workbook. In column B I have all
sorts of values from 0001 to 9999.

What I want: on the second sheet I want that list automatically generated,
but only when they have values of 4000 to 4999 and 8000 to 8999 in column B.

An event macro or something? But how?
 
Something like this macro maybe. Place this macro in the sheet module of
the sheet that holds the original list. I chose "OtherSheet" as the name of
the destination sheet. Change this as you wish. Note that this macro fires
whenever a value is changed in Column B. As such, it will operate on only
that one value. Whenever another cell is changed in that column, the macro
will operate on that value. The macro would have to be rewritten if you
want it to operate on every value in the entire column in one run of the
macro. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Not Intersect(Target, Range("B:B")) Then
If (Target.Value >= 4000 And Target.Value <= 4999) Or _
(Target.Value >= 8000 And Target.Value <= 8999) Then
With Sheets("OtherSheet")
.Range("A" & Rows.Count).End(xlUp).Offset(1) =
Target.Value
End With
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top