Copy row when a certain value is on Sheet1 to Sheet2

Key M

New Member
Joined
Dec 18, 2018
Messages
3
Hi
I am new to VBA. and need a lots of help to make it work.

The first Sheet (Everything) got everything, and when i put a value under department like Miami then i want to copy the entire row to my Sheet called Miami.
And so on. I have googled it and watched some youtube, but i cant figure out what to do.

ComputernameUsernameComputerDepartmentSerialnumberInstalled
PC01AdminLatitude E7450Miami11111112017-09-25
PC02SellSurface 3New York22222222017-05-01
PC03EconLatitude E7450Seattle33333332013-09-11
PC04Seller2Surface 3New York44444442017-05-01

<tbody>
</tbody>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
It looks like you're tracking inventory. Is there a reason you can't just leave it all one one tab and filter for a single department/location when you need to?
 
Upvote 0
It looks like you're tracking inventory. Is there a reason you can't just leave it all one one tab and filter for a single department/location when you need to?

Thanks for anwer.
Its to keep it cleaner and easier for end-users, and they also wanted to have this function for other projects.
Im just an IT-Admin so i promised to much and told them that i will probably solve it :eek:
 
Upvote 0
You still don't want to have to worry about maintaining data in multiple worksheets.

What I would do (and have done) is write a macro that filters your main sheet for each department/location and then saves them as individual files. That way, after making updates, you just run the macro. And everyone knows where to go to get the most current copy of each.
 
Upvote 0
I found something pretty close to what im searching for.

How can i Make this Macro to "Auto-Run" as soon as a new row is typed?

Option Explicit


Sub Test()


Dim Cell As Range


With Sheets(1)
' loop column D untill last cell with value (not entire column)
For Each Cell In .Range("D2:D" & .Cells(.Rows.Count, "D").End(xlUp).Row)
If Cell.Value = "Miami" Then
' Copy>>Paste in 1-line (no need to use Select)
.Rows(Cell.Row).Copy Destination:=Sheets(2).Rows(Cell.Row)
End If
Next Cell
End With


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,523
Messages
6,120,028
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top