PDA

View Full Version : vba code moving data of row from one sheet to another & vice versa



mailpargyan
01-19-2013, 04:13 AM
Hello ,

I am using following web code for Shifting a row data from B Column (containing List of 4 options i.e. Network, billing, Resolved & GMCC through validation option) to Another Sheet & from that sheet to Another or Original Sheet. In original sheet I've pasted the following . It is working & Transferring
row to another. ONCE I pasted same code to another than I'll getting error .
Please help to resolve the error.


Option Explicit
Dim Flag As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
If Flag = True Then Exit Sub
If Not Intersect(Target, Range("B1:B" & LR)) Is Nothing Then
If Target.Value = "BILLING" Then
LR = Sheets("Billing").Range("A" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy
Sheets("Billing").Range("A" & LR).PasteSpecial
Flag = True
Target.EntireRow.Delete
Else
If Target.Value = "NETWORK" Then
LR = Sheets("Network").Range("A" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy
Sheets("Network").Range("A" & LR).PasteSpecial
Flag = True
Target.EntireRow.Delete
Else
If Target.Value = "RESOLVED" Then
LR = Sheets("Resolved").Range("A" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy
Sheets("Resolved").Range("A" & LR).PasteSpecial
Flag = True
Target.EntireRow.Delete
Else
LR = Sheets("GMCC").Range("A" & Rows.Count).End(xlUp).Row + 1
Target.EntireRow.Copy
Sheets("GMCC").Range("A" & LR).PasteSpecial
Flag = True
Target.EntireRow.Delete
End If
End If
End If
End If
Application.CutCopyMode = False
Flag = False
End Sub

Aussiebear
01-19-2013, 03:46 PM
What is the error you are receiving?

mailpargyan
01-21-2013, 01:09 AM
hOW COULD I , CROSS CONNECTED ALL THE WORKSHEETS FOR THE SAME PURPOSE. sHALL i PASRED SAME CODE ON ALL WORKSHEETS( DO THIS IS GENERATING AN ERROR) OR THERE ARE SOME OTHER SUGGESTION TO DOING IT.

Aussiebear
01-21-2013, 03:29 AM
Firstly, please type in lower case letters as using capital letters is considered poor internet conversation.

I asked you what is the error you are receiving? Is your code failing on a particular line of code, and if so, which line is it? Or is it simply that your code is not doing that which you had hoped for it to complete?

Can you indicate which part is completeing and or which parts are not? Is it possible for you to upload a sample file which we can use to simulate your issue? To upload a sample file, click on Go Advanced, scroll down to Manage Attachments and follow the prompts from there.