Moving Data to Another Sheet Based on Dropdown Selection

jeff88

New Member
Joined
Jan 25, 2024
Messages
16
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hello,

I am trying to setup a workbook with two sheets, one for in-progress jobs and one for completed jobs. The in-progress jobs will have 1 row for each job and a column at the end will have a dropdown with a "Complete" option when the job is completed. When a user selects the "Complete" option, Excel will automatically move the row of data into the completed jobs sheet and delete the (now) empty row.

I have seen other threads on the web and this forum with this action (like this one), but I can't seem to get the code to work. I copy/pasted/changed sheets names & columns for what I need, but it doesn't seem to work. I've also tried working out my own code using bits from that link and some other Googled options without any luck.

I have a basic knowledge of code, but not enough to troubleshoot where the issue is.

I'm using Excel web app.
 

Attachments

  • Excel Data Snip.JPG
    Excel Data Snip.JPG
    31.8 KB · Views: 48
I think that I can see the problem. Change emd(xlup) to end(xlup). That was a typographical error on my part. Sorry for that.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
If you are using this in SharePoint or similar macros won't work. You would need to open in excel and then activate the macro.

You could use a button on your sheet with this code. You will need to update sheet names etc to match your spreadsheet.To run the script you would need to open in Excel then press the button.

This code assumes both sheets have tables on them called Table2 and Table2.

t0ny84
How do I know if I am using it in SharePoint? I know we use SharePoint, but I'm opening Excel directly on desktop.
Also, do you have a code that will work automatically without the use of a button? I want to make this as foolproof as possible.
 
Upvote 0
I think that I can see the problem. Change emd(xlup) to end(xlup). That was a typographical error on my part. Sorry for that.
I changed it and restarted Excel, but still getting the same errors saying it's expecting semi-colons and commas. It's also saying it cannot find the "name" for a lot of lines.
 
Upvote 0
Where is the Excel Spreadsheet saved? It should allow you to see.

Mumps code should work by updating emd to end.

Can you take a screenshot of the error.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 10 Then Exit Sub
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    If Target = "Complete" Then
        With Sheets("Completed Jobs")
            Target.EntireRow.Copy .Cells(.Rows.Count, "A").end(xlUp).Offset(1)
            Target.EntireRow.Delete
        End With
    End If
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Where is the Excel Spreadsheet saved? It should allow you to see.

Mumps code should work by updating emd to end.

Can you take a screenshot of the error.
It's saved to my OneDrive.

Here are two snips of the "output" errors and the "problems" errors. There are more if I scroll down the list of errors, but you can get the idea of what it's coming back with.
 

Attachments

  • Excel Output Error.JPG
    Excel Output Error.JPG
    42.8 KB · Views: 7
  • Excel Problems Error.JPG
    Excel Problems Error.JPG
    36.1 KB · Views: 7
Upvote 0
Opening the file on One Drive through the web would make the macros not work.

Regarding the errors can you put up a screenshot of your VBA Editor with the code.

Alt + F11 will open I the editor.

t0ny84
 
Upvote 0
Opening the file on One Drive through the web would make the macros not work.

Regarding the errors can you put up a screenshot of your VBA Editor with the code.

Alt + F11 will open I the editor.

t0ny84
It's saved to my OneDrive, but I'm opening it on the desktop. Maybe I can try saving my file to my documents folder? I attached the code exactly as I have it. Note the change from emd to end.
 

Attachments

  • Excel Code As-written.JPG
    Excel Code As-written.JPG
    31.4 KB · Views: 8
Upvote 0
It shouldn't make a difference but yes please try saving a copy to your computer and seeing if the error still occurs.
 
Upvote 0
The screen shots you posted don't look like the usual type of messages that Excel displays when a macro generates an error. Neither does the screen shot of your whole sheet. This what it should look like.
1706277294192.png

I duplicated the sample data you posted to look like this in Sheet1:
Book1
ABCDEF
1Job #CustomerAddressPermitAHJJob Complete
2123458c1236 MainIssuedSan Jose
3123459d1237 MainIssuedSan Jose
4123460e1238 MainIssuedSan Jose
5123461f1239 MainIssuedSan Jose
6123462g1240 MainIssuedSan Jose
7123463h1241 MainIssuedSan Jose
Sheet1


This was the result of the macro in sheet Completed Jobs:
Book1
ABCDEF
1Job #CustomerAddressPermitAHJJob Complete
2123457b1235 MainIssuedSan JoseComplete
Completed Jobs
You'll notice that this line of data has been deleted from Sheet1. Everything is working properly. What version of Excel are you using?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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