HI,
I hope I'm doing this correctly, as it's my 1st post.
Great info here, I'm relatively new to Excel, but i know it does what I want, it's just getting to that point
I'm trying to move a row (horizontal) from sheet1 to sheet2 automatically based on there being content in column b (vertical),
what i'm trying to do is create a 2nd sheet (invoice in this exercise) where the whole row of is moved onto sheet2 based on there being a value in colume B
I hope this explains the excercise in hand?
I've attached a sample worksheet so you can see the example a bit clearer,
The idea is to create a sheet that automatically populates with the data from sheet1 to sheet2 to eliminate the copy and pasting of data every time a report is filled as only the the data that has a value in it from sheet1 column B is required as its a completed task.
(I hope I'm making sense)
So far I've used this,
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("B:B")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = vbNullString Then Exit Sub
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim lRow As Long
lRow = Range("A" & Rows.Count).End(xlUp).Row
For Each cell In Range("B7:B" & lRow)
If cell.Value > 0 Then
Range(Cells(cell.Row, "A"), Cells(cell.Row, "P")).Copy
Sheets("Sheet2").Range("B100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
Next
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.CutCopyMode = False
MsgBox "Data transfer completed!", vbExclamation
End Sub
but it doesn't work well as if a value is put in column B, then removed, the data stays on sheet2,
(I've removed the data transferred box as well, as it pops up every time a value is placed in column B)
Any help would be greatly appreciated,
I've tried searching but the results require tweaking, which my limited knowledge doesn't allow for.
Sample
https://www.dropbox.com/s/nimoic63gaqlusz/TEST TEMPLATE C-W INVOICE.xlsx?dl=0
Thanks in advance
Skreechy
I hope I'm doing this correctly, as it's my 1st post.
Great info here, I'm relatively new to Excel, but i know it does what I want, it's just getting to that point
I'm trying to move a row (horizontal) from sheet1 to sheet2 automatically based on there being content in column b (vertical),
what i'm trying to do is create a 2nd sheet (invoice in this exercise) where the whole row of is moved onto sheet2 based on there being a value in colume B
I hope this explains the excercise in hand?
I've attached a sample worksheet so you can see the example a bit clearer,
The idea is to create a sheet that automatically populates with the data from sheet1 to sheet2 to eliminate the copy and pasting of data every time a report is filled as only the the data that has a value in it from sheet1 column B is required as its a completed task.
(I hope I'm making sense)
So far I've used this,
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("B:B")) Is Nothing Then Exit Sub
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = vbNullString Then Exit Sub
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim lRow As Long
lRow = Range("A" & Rows.Count).End(xlUp).Row
For Each cell In Range("B7:B" & lRow)
If cell.Value > 0 Then
Range(Cells(cell.Row, "A"), Cells(cell.Row, "P")).Copy
Sheets("Sheet2").Range("B100").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
End If
Next
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.CutCopyMode = False
MsgBox "Data transfer completed!", vbExclamation
End Sub
but it doesn't work well as if a value is put in column B, then removed, the data stays on sheet2,
(I've removed the data transferred box as well, as it pops up every time a value is placed in column B)
Any help would be greatly appreciated,
I've tried searching but the results require tweaking, which my limited knowledge doesn't allow for.
Sample
https://www.dropbox.com/s/nimoic63gaqlusz/TEST TEMPLATE C-W INVOICE.xlsx?dl=0
Thanks in advance
Skreechy