Error 400

Ambiguooous

New Member
Joined
Jun 6, 2018
Messages
30
Hi to all ..

I want to know what is the problem with me in this code ?? because not accepted to run (error 400)

Sub SaveAsValues()
Dim ws As Worksheet


For Each ws In Worksheets
ws.UsedRange = ws.UsedRange.Value
Next ws

ThisWorkbook.SaveAs "Z:\Collateral Monitoring\Daily\LMM - " & Format(Date, "dd mmmm yyyy")
End Sub
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try
Code:
ws.UsedRange[COLOR=#ff0000].Value[/COLOR] = ws.UsedRange.Value
 
Upvote 0
Error 400's are a bit funky. Best way to source the error is to step through the code. PS the code ran fine on my PC
 
Upvote 0
If you have sheet protection, then you will need to remove it.
Record a macro of you unprotecting & reprotecting a sheet & see if you can add that to your code.
 
Upvote 0
I removed the sheets protection from each sheet & replace it with a file password "when you want to open the workbook, it ask you the password" and it works :) however the new generated file needs the same password, what is the amendment i need in order to generate a new workbook "free password"



Sub SaveAsValues()
Dim ws As Worksheet


For Each ws In Worksheets
ws.UsedRange = ws.UsedRange.Value
Next ws

ThisWorkbook.SaveAs "Z:\Collateral Monitoring\Daily\LMM - " & Format(Date, "dd mmmm yyyy")
End Sub
 
Upvote 0
I removed the sheets protection from each sheet & replace it with a file password "when you want to open the workbook, it ask you the password" and it works :) however the new generated file needs the same password, what is the amendment i need in order to generate a new workbook "free password"



Sub SaveAsValues()
Dim ws As Worksheet


For Each ws In Worksheets
ws.UsedRange = ws.UsedRange.Value
Next ws

ThisWorkbook.SaveAs "Z:\Collateral Monitoring\Daily\LMM - " & Format(Date, "dd mmmm yyyy")
End Sub


Help Pleeeeeease !!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,329
Members
452,635
Latest member
laura12345

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