VBA

jdlerry

New Member
Joined
Apr 6, 2021
Messages
32
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone, I need your help please. I just need VBA code to get my reports working. What I want to do is whenever these dropdowns are selected, it should automatically go to another sheet.

Completed: CCG Response
Completed: GSS Notification
Completed: IV Notification



Another VBA code that I need help of is whenever a dropdown is selected, it should go to the intended sheet. For example, I have a masterlist in sheet 1 which contains projects and from the dropdowns, I will select the name of the owner per project. Once selected, it should automatically move to the intended sheet. The difference with the first concern is the destination sheet. There will be multiple destination sheets which correspond the owner.

Thank you!
 
No....if the code is pasted in the "MasterList" sheet module
THEN
if you make a change to any dropdown in column "K", that row should be pasted over to the"Completed Cases" Sheet on the lastrow + 1
If you are having further issues can you upload the workbook to DropBox, or similar hosting site, then post the link back here, so we can take a look at the problem
Thank you so much for the extra mile. When you check "K" which is the status, the 3 dropdowns that says Completed should transfer to Completed Cases once selected.

 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
First thing...You MUST save the workbook as a macro enabled workbook....that is a file with a .xlsm file extension..NOT a .xlsx file extension.
If you don't, every time you save the file the macro will be lost
The code is pasted in the "MasterList" sheet module
 
Upvote 0
I've also made a slight change to make sure the other "Options" aren't copied across
VBA Code:
Private Sub worksheet_Change(ByVal target As Range)
Dim lr As Long
If Not Intersect(target, Range("K:K")) Is Nothing Then
ans = Evaluate("Left(" & ActiveCell.Address & ",9)")
If ans <> "Completed" Then Exit Sub
 lr = Sheets("Completed Cases").Cells(Rows.Count, "A").End(xlUp).Row
Application.EnableEvents = False
Rows(ActiveCell.Row).Copy Sheets(ans & " Cases").Range("A" & lr + 1)
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
You are so amazing! it works now!!!!! One last concern. I probably have not mentioned this, but it's not just copy paste. It should be removed from the masterlist once tagged as completed. How do I that?
I've also made a slight change to make sure the other "Options" aren't copied across
VBA Code:
Private Sub worksheet_Change(ByVal target As Range)
Dim lr As Long
If Not Intersect(target, Range("K:K")) Is Nothing Then
ans = Evaluate("Left(" & ActiveCell.Address & ",9)")
If ans <> "Completed" Then Exit Sub
lr = Sheets("Completed Cases").Cells(Rows.Count, "A").End(xlUp).Row
Application.EnableEvents = False
Rows(ActiveCell.Row).Copy Sheets(ans & " Cases").Range("A" & lr + 1)
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Here you go....replace the code in the Sheet module with this one
VBA Code:
Private Sub worksheet_Change(ByVal target As Range)
Dim lr As Long
If Not Intersect(target, Range("K:K")) Is Nothing Then
ans = Evaluate("Left(" & ActiveCell.Address & ",9)")
If ans <> "Completed" Then Exit Sub
 lr = Sheets("Completed Cases").Cells(Rows.Count, "A").End(xlUp).Row
Application.EnableEvents = False
Rows(ActiveCell.Row).Copy Sheets(ans & " Cases").Range("A" & lr + 1)
Rows(ActiveCell.Row).Delete
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Here you go....replace the code in the Sheet module with this one
VBA Code:
Private Sub worksheet_Change(ByVal target As Range)
Dim lr As Long
If Not Intersect(target, Range("K:K")) Is Nothing Then
ans = Evaluate("Left(" & ActiveCell.Address & ",9)")
If ans <> "Completed" Then Exit Sub
lr = Sheets("Completed Cases").Cells(Rows.Count, "A").End(xlUp).Row
Application.EnableEvents = False
Rows(ActiveCell.Row).Copy Sheets(ans & " Cases").Range("A" & lr + 1)
Rows(ActiveCell.Row).Delete
End If
Application.EnableEvents = True
End Sub
Oh my!! It works!!!!! Thank you.

Not perfect though :( When I click save, exit and reopen, it does not work again. I checked and the code is still there. Not sure which step did I miss but here's the step by step process:
1. Saved as .xlsm
2. From Masterlist tab, I right clicked, then View Code.3
3. Paste the code you provided
4. ctrl +S to save
5. It worked!
6. Clicked ctrl +S to save and made sure it is xlsm then exit
7. reopened the file
8. Not working again :(

Really really appreciate your patience.
 
Upvote 0
Are you making a change to a cell in column "K" when you reopen the file ?
AND
The cell your are changing does have "Completed" as the first word in the text string ?
 
Upvote 0
Are you making a change to a cell in column "K" when you reopen the file ?
AND
The cell your are changing does have "Completed" as the first word in the text string ?
Yes. So when I reopen to check if it still works, I change a cell in K with a dropdown that says Complete.
Are you making a change to a cell in column "K" when you reopen the file ?
AND
The cell your are changing does have "Completed" as the first word in the text string ?
It works now. THANK YOU!!Is there a way that this will work through Microsoft Teams as a shared file? or Macros don't work in web based?
 
Upvote 0
Sorry..i have no idea obout that.
Hopefully someone else may be able to help
 
Upvote 0

Forum statistics

Threads
1,214,805
Messages
6,121,665
Members
449,045
Latest member
Marcus05

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