ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   need a little help with some basic scripting (https://www.excelbanter.com/excel-programming/388671-need-little-help-some-basic-scripting.html)

[email protected]

need a little help with some basic scripting
 
Hi:

This is my first post and I'm new to VB and excel scripting. (so any
advice is welcome).

OBJECTIVE:
To rearrange workbook data based on the value of a target cell. In a
4 spreadsheet workbook where sheets are labeled 'Master', 'Personal',
'Corporate' and 'Disconnect' it is desirable to copy data from the
master worksheet to the appropriate sheet based on the 'STATUS' value
(column 'F' or '6') from the master workbook. Target values are 'P",
'C' or 'D' cooresponding to the listing above.

METHOD:
To accomplish the above, the following code was inserted within the
Master worksheet, borrowing from many resources posted he

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 6 Then
If Target.Value = "P" Then
Cells(Target.Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Personal").Cells(Rows.Cou nt, 1).End(xlUp)(2)
End If
If Target.Value = "C" Then
Cells(Target.Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Corporate").Cells(Rows.Co unt, 1).End(xlUp)(2)
End If
If Target.Value = "D" Then
Cells(Target.Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Disconnect").Cells(Rows.C ount, 1).End(xlUp)
(2)
End If

ActiveWorkbook.Save
End If


End Sub


RESULT:
Using this code results in active processing of the main worksheet as
values are entered in the sheet. While this is effective, there is no
method for adjusting the output sheets when the values change.

INQUIRY TO GROUP:
How can this code be modified to allow for the reprocessing of the
data (and perhaps re-writing of the output sheets) when target values
are over-written?

THANKS! Please email or post and suggestions or clarification
requests

Frank



All times are GMT +1. The time now is 05:17 PM.

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