Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Using validation to move cells

Hi,
Is there any way of using a validation drop down in a cell to trigger the
movement of a row of cells from one sheet to another within a workbook?
For example:
On the "Open!" worksheet, range A1:A20 contains various values (text,
formulae, numbers etc.). A21 has a validation drop-down that selects between
"Open" and "Closed".
When I change the value of A21 from "Open" to "Closed" I want to transfer
the contents of A1:A21 to the worksheet "Closed!"
TIA
Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Using validation to move cells

Hit Alt F11
Select the Sheet where the data is from the project explore window by
clicking on it, then on the dropdow box in the code window select worksheet
you should get the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

In Between the two lines type this:
If Range("A21") = "Closed" Then
Range("A1:A21").Copy Destination:=Worksheets("Closed").Range("A1")
End If

--

If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Risky Dave" wrote:

Hi,
Is there any way of using a validation drop down in a cell to trigger the
movement of a row of cells from one sheet to another within a workbook?
For example:
On the "Open!" worksheet, range A1:A20 contains various values (text,
formulae, numbers etc.). A21 has a validation drop-down that selects between
"Open" and "Closed".
When I change the value of A21 from "Open" to "Closed" I want to transfer
the contents of A1:A21 to the worksheet "Closed!"
TIA
Dave

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Using validation to move cells

Michael,

Thanks for the response.

Is there any way of modifying this so that if In have, say 100, lines each
can be moved indivuidually as the status is changed to "Closed" without
overwriting previous entries (I'm thinking some sort of do... while... loop)?

TIA

Dave

"Michael" wrote:

Hit Alt F11
Select the Sheet where the data is from the project explore window by
clicking on it, then on the dropdow box in the code window select worksheet
you should get the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

In Between the two lines type this:
If Range("A21") = "Closed" Then
Range("A1:A21").Copy Destination:=Worksheets("Closed").Range("A1")
End If

--

If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Risky Dave" wrote:

Hi,
Is there any way of using a validation drop down in a cell to trigger the
movement of a row of cells from one sheet to another within a workbook?
For example:
On the "Open!" worksheet, range A1:A20 contains various values (text,
formulae, numbers etc.). A21 has a validation drop-down that selects between
"Open" and "Closed".
When I change the value of A21 from "Open" to "Closed" I want to transfer
the contents of A1:A21 to the worksheet "Closed!"
TIA
Dave

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Using validation to move cells

First set the number of lines, if you base it on the last cell of the column
where the data is you could use something like this:

iLastRow=Range("A65536").end(xlUp).row
This should tell you how many rows to check on your loop. Now the loop:

For i =1 to iLastRow
If Range("A" & iLastRow) ="Closed" then
Range("A" & iLastRow).Copy Destination:=Worksheets("Closed").Range("A" &
iLastRow)
End If

This will run in one step, meaning, you will have to do the data validation
for all of the cells before you run this code. The code should be attached to
a button and executed after the data validation has occurred. It will place
the data in the same exact spot except it will do it in the "Closed" sheet.

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Risky Dave" wrote:

Michael,

Thanks for the response.

Is there any way of modifying this so that if In have, say 100, lines each
can be moved indivuidually as the status is changed to "Closed" without
overwriting previous entries (I'm thinking some sort of do... while... loop)?

TIA

Dave

"Michael" wrote:

Hit Alt F11
Select the Sheet where the data is from the project explore window by
clicking on it, then on the dropdow box in the code window select worksheet
you should get the following:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub

In Between the two lines type this:
If Range("A21") = "Closed" Then
Range("A1:A21").Copy Destination:=Worksheets("Closed").Range("A1")
End If

--

If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Risky Dave" wrote:

Hi,
Is there any way of using a validation drop down in a cell to trigger the
movement of a row of cells from one sheet to another within a workbook?
For example:
On the "Open!" worksheet, range A1:A20 contains various values (text,
formulae, numbers etc.). A21 has a validation drop-down that selects between
"Open" and "Closed".
When I change the value of A21 from "Open" to "Closed" I want to transfer
the contents of A1:A21 to the worksheet "Closed!"
TIA
Dave

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
automatically move entire row by cell validation Nynke Excel Discussion (Misc queries) 0 October 8th 10 04:51 PM
Sorting cells: a list behind the cells do not move with the cell Ross M Excel Discussion (Misc queries) 2 September 21st 06 12:14 PM
Move Active Cell after Data Validation List [email protected] Excel Programming 3 May 30th 06 03:15 PM
Data Validation Cell - Move to UserForm thom hoyle Excel Worksheet Functions 0 April 28th 05 12:23 AM
Two validation cells populated third validation sowetoddid[_29_] Excel Programming 2 June 9th 04 09:44 PM


All times are GMT +1. The time now is 09:47 PM.

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"