Find & Replace On Protected Sheets Fails

Jan 10, 2007

I am attempting to run a macro that will do a find and replace on a protected sheet but this is not working. I am using the following code to Protect all Sheets, which I found on this site when workbook opens using the Workbook Open Event and uses UserInterFaceOnly :

Private Sub Workbook_Open()
Dim wSheet As Worksheet

For Each wSheet In Worksheets
wSheet.Protect Password:="111", _
UserInterFaceOnly:=True
Next wSheet
End Sub

And then a find and replace similar to this:

Sub FindAndReplace()
Selection.Replace What:="w", Replacement:="a", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

View 6 Replies


ADVERTISEMENT

Find And Replace On Protected Sheet

Nov 28, 2006

Is it possible to run a find and replace macro on a protected sheet? I know you can't use the built in Find and Replace but was hoping that I could get around that by using a macro.

View 9 Replies View Related

Protected Sheet - Macro To Unprotect, Refresh Sql Query & Re-protect Fails

Feb 21, 2007

I have a protected worksheet containing an SQL query. I have two cells on the worksheet unlocked so that users can enter fresh parameters to feed the query.
Because I have to use MS Query to interrogate our SQL server (current IT decree), the query won't support parameters directly when the query cannot be represented graphically - so I have to manually edit the sql command text and then refresh the query - or at least that was why I wrote the code below

The problem: My macro won't unprotect the sheet before it calls the SQL.it therefore won't update the sheet to detail the DSN, command text and number of parameters (latter should be 0) - info just used to verify queryit won't run the query / return the data as the sheet is still protected Comment: I have had to remove sheet protection in order to allow the sql to execute and return data. If protection is removed, the query does execute and return data ( changes in the "parameter" cell contents do cause the query to be correctly modified)
I could comment out the debug info but the query still doesn't return data if the sheet is protected.

Activesheet And worksheets(ndx) where ndx has been defined As ActiveSheet.Name
I apologise If my post Is difficult To follow - especially the code.

Sub AgedStockParameters()
nmb = ActiveWorkbook.Name
ndx = ActiveSheet.Name
Workbooks(nmb).Activate
Worksheets(ndx).Activate
ActiveSheet.Range("A1").Select
WkshtQryCon = Workbooks(nmb).Worksheets(ndx).QueryTables(1).Connection
ActiveCell.Value = WkshtQryCon
Range("A2").Select
WkshtQryFld = Workbooks(nmb).Worksheets(ndx).QueryTables(1).CommandText
ActiveCell.Value = WkshtQryFld.......................

View 2 Replies View Related

Find & Replace Data Between 2 Sheets

Jan 30, 2008

I have in sheet1:

Item QTY
A 1
B 10
C 0

In sheet2 I have

Item QTY
B

View 6 Replies View Related

Multiple Find And Replace Over An Array Of Sheets

Jul 6, 2007

I have a list of cell entries that I want to find and replace with different text or a number.
My code below is 4 of them.
I am trying to do the replace over 3 different sheets at the same time but I am only changing the 1st sheet with my efforts.

Sub Find_And_Replace()

Sheets( Array("Resolution", "Response", "Open")).Select
Sheets("Resolution").Activate

Cells.Replace What:="1 Widespread*", Replacement:="1", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:="2 Critical*", Replacement:="2", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:="3 Non*", Replacement:="3", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

Sheets(Array("Resolution", "Response", "Open")).Select

Cells.Replace What:="4 Require*", Replacement:="4", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

End Sub

View 8 Replies View Related

Find And Replace Matching Cells Across Multiple Sheets

Dec 11, 2013

Following Excel task I am trying to complete:

I have an Excel file with multiple sheets and I want to find and replace matching cell data on the same row across all of the sheets. For example, I have two columns, Column A and Column C and 10 sheets. I want to only replace the content in Column A if text matches both Column A and Column C on the same row. So, I want to be able to search for the following data across all sheets:

Column A = "car"
Column C = "yellow"

If both "car" and "yellow" are found in Column A and Column C on the same row, then replace "car" in Column A with "truck".

Is there a way to do this automatically as I have few hundred to find and replace?

View 5 Replies View Related

Macro To Find And Replace Values Across Multiple Sheets In Same Workbook?

May 27, 2014

I have an excel workbook with 60 sheets (each contain data in the same categories and in the same column locations, just different information on each sheet). What would the VBA code look like if I wanted to manually enter the find and replace values and perform the function (find and replace) across multiple sheets in the workbook?

View 5 Replies View Related

Copying Multiple Sheets Fails

Jan 8, 2007

I have a large workbook which has about 15 sheets. About half of these are template sheets which are copied multiple times within this workbook. The workbook is very large and can't be posted. I would like to hear from anyone who can give me any direction to look in given the following symptoms. The problem is that VBA code stops executing and gives a 1004 Error. *The problem is stable and reproduceable.

*It occurs exactly the same across three different computers with varying versions of Excel and memory.

*The problem is persistant beyond VBA. By that I mean if I stop the debugger and try to manually copy the active sheet, the screen flashes but the sheet is not copied. Therefore I think the 1004 error is a symptom rather than a cause

*From scratch, I get to copy 43 times before I get the error.

*If I then save the workbook and re-open (don't need to close Excel) I then get to copy another 27 sheets.................................

View 2 Replies View Related

Sheets Copy Method Fails On Second Execution

Dec 26, 2006

When I call the following code from my Visual Basic 6 program to an excel spreadsheet, it runs great the first time, but then fails everytime after that unless I close vb6 and reopen it.

Private Sub lblGroundScheduleExcel_Click()


'return day of week
'MYHEADERDAY = Format(Now, "dddd")

'get day
''MyDay = Format(Now, "dd")
MyDay = Format(DTPicker1.Value, "dd")
'get month
''MyMonth = Format(Now, "mm")
MyMonth = Format(DTPicker1.Value, "mm")
'get year
''MyYear = Format(Now, "yyyy")
MyYear = Format(DTPicker1.Value, "yyyy")

View 3 Replies View Related

CommandButton And FIND Fails

Sep 16, 2009

Haven't done a LOT with forms, but this should work (in my mind) and doesn't.

I'm using a ComboBox linked to a named range of "DATES" for a user to select a date. All I want to do is find that date in column A of the Sheet1.

View 7 Replies View Related

Delete Chart Series Across Sheets But Skip Protected Sheets

Mar 30, 2008

I have received following macro from someone to delete series but the problem is that it gives error when some sheets are protected, and I want those sheets to protected. When run it will ignore/leave protected sheets but delete series only from unprotected sheets

Private Sub CommandButton1_Click()
Dim Rng As Range, i As Long, r As Range, lVal, uVal
Dim DeleteCount As Double
Dim lRow As Long
Dim dr As Long
Dim dc As Long
dc = Sheets("Deleted Numbers").UsedRange.Columns.Count - 1
dr = Cells(Rows.Count, Sheets("Deleted Numbers").UsedRange.Columns.Count - 1).End(xlUp).Row + 1
If dr = 60001 Then ................

View 4 Replies View Related

Excel 2003 :: Find And Replace Missing The Ability To Replace Values?

Feb 5, 2009

This problem has come up fairly frequently lately, and I'm not sure how to fix it, or if this is by design...but in Excel 2003 I can't seem to do a "Find and Replace" based on the value of a cell. I can do a find, based on cell value, but the moment I change to the replace tab, the "values" and "comments" are missing from the "look in" dropdown.

I've only noticed this when I'm trying to replace on a filtered list, so I'm not sure if that is part of the issue.

Perhaps an alternative way of arriving at the same goal. Basically I have a worksheet with a number of filtered columns. They are filtered just right, using custom filtering, and so I do not want to undo the filters. In some columns I have formulas that are returning #VALUE! errors. I'd like to replace all of these cells with NA.

View 6 Replies View Related

Find And Replace To Not Replace Characters Found As Wildcards?

Jul 2, 2013

I recently became owner of a spreadsheet with some issues, and I am trying to make it useful. Each row has a URL of a blog post, and I want to extract the date from it (which is present in each URL) while getting rid of the rest of the URL. I was able to get rid of everything up to the year (which comes first), but then the URL continues, for example, 2013/05/16/the-rest-of-the-url/ and I would like to just have 2013/05/16 remain.

I am trying to use find and replace with the find box reading 2013/??/??/*/ and replacing it with 2013/??/?? which effectively erases everything else in the url, but leaves ?? instead of the numbers. Is there any way to have it so that it keeps whatever was in the original box?

View 4 Replies View Related

Doing Find / Replace Not Working If Replace Text Is Too Large

Feb 5, 2014

[Code] .....

Trying to repeat a 550 or so character statement with a find/replace however I am getting type mismatch errors. When I use a smaller message in the "replace" it works.

I need it to post a message exactly as long as what I have in there. How do I get it to work?

View 6 Replies View Related

Catching Errors When Using The Find / Replace Function / Replace All

Apr 20, 2006

Need assistance with the code for catching errors when using the find / replace function in excel? In particular, I am trying to write code to break to an error message when the value or string searched for isn't found in the find / replace. At the minute I have just copied the standard code using a macro and all this does is return a message box saying X entries replaced.

View 3 Replies View Related

Find, Replace With And Then Replace Adjacent Cell

Mar 18, 2009

I am trying to create a macro where it finds a a certain word in a column for example C. What i want it to do is find anything that says FWD_EUR and then replace that cell (e.g C2) with CASH_EUR_FWD and after it has done that it replaces the adjacent cell (e.g. D2) with EUR_FWD. I then want this to do the same with FWD_USD to CASH_USD_FWD and adjacent cell to USD_FWD.

View 2 Replies View Related

Find Replace :: Find All Occurences Of And Or AND And Replace With And

Oct 26, 2009

Range B3:B1000 is text strings. Column C2:C50 is a list of words that I would like to "Find" in Column B and replace with it's lowercase values unless they start off the string.

Example

Find all occurences of And or AND and replace with and
Find all occurences of With or WITH and replace with with.
Find all occurences of Or or OR and replace with or

View 9 Replies View Related

How To Password Protected All Sheets At Once

May 15, 2014

i want to protect my all sheets at once

View 3 Replies View Related

Macros On Protected Sheets

Nov 21, 2006

I have a spreadsheet with some macros in it. When I run the macros, I would like to unprotect the worksheet and then protect the spreadsheets when the macros are done. The excel tabs I would like to protect/unprotect are called Graph and Data.

View 3 Replies View Related

How To Unprotect A Workbook And Sheets That Already Protected

Mar 10, 2014

I have a workbook that is protected by password. I have to unprotect sheets.

How can I unprotect sheets and workbooks while I am updating or changing?

View 13 Replies View Related

Search Column A In All Protected Sheets

Nov 15, 2008

I need a simple Macro that will, sheet by sheet, search the entire workbook. However, it only needs to search Column A, and there need be no text box, because the user will not define the text. The search text will simply be "X"

The real issue that I'm having is that I need it to find the first item, then offer me the option of selecting "Next" "Previous" or "Cancel" "Cancel" of course would mean that the item found is the one being searched for.

View 14 Replies View Related

Custom View When Other Sheets Protected,

Nov 29, 2007

I have a workbook with 3 spreadsheets. When I put ptotection on 2 of the sheets, the custom view will not work on the other. Any way to make the views work?

View 5 Replies View Related

Comboboxes, Autofilter And Protected Sheets

Jun 12, 2006

Everything works fine except when I password protect the sheet. Then when the autofilter is used an error message is triggered and the error relates to the first range selected in the combobox code. However, the combobox itself works fine on the protected sheet as I included code to unprotect the sheet at the beginning of the code run by the combobox and reprotect it at the end.
Any advice suggestions gratefully received.

View 9 Replies View Related

Running Macros On Protected Sheets ....

Feb 19, 2007

I have the following code as workbook module but it is not working, I have tried fiddling with it but I cannot work out what is wrong, can anyone help please.

Private Sub Workbook_Open()

Dim ws As Worksheet ....

View 9 Replies View Related

Protected Zoom Level For All Sheets For All Users?

Dec 22, 2013

I've created a shared spreadsheet with multiple sheets. All the content was created to be visible without having to scroll at 87%. My question is can I protect or lock the zoom level so that when anyone else opens the spreadsheet, it will only be visible at 87%? I have my screen resolution at "Smallest" so not sure if that too will affect the viewing level.

View 7 Replies View Related

Getting Error When Userform Transfers To Protected Sheets

Jan 30, 2014

I have a userforms which transfers data to protected sheets.The userforms worked until i protected each sheet.Can there be any code which i add to the current userform code so it can still transfer the data to protected sheets

The other issue also is now that the sheets are protected the Outlining also does not work.Can this also be changed so the Outlining works on protected sheets

I have 5 userforms which all transfer data.

[Code].....

View 5 Replies View Related

Sort Data On Protected & Hidden Sheets

Sep 16, 2007

Is there a way I can sort multiple hidden protected worksheets with a password “Protect”
I have 12 worksheets “Jan”, “Feb”. Etc

“The Range on each worksheet is the same ("A11:CR200") ....

View 9 Replies View Related

Retain Use Of Group/Outline On Protected Sheets/Worksheets

Oct 5, 2006

I have a sheet that I protect but i use the below code so that I can still use my gouping '+' or '-' symbols to hide/unhide rows.

ws.Protect Password:="PASSWORD", userinterfaceonly:=True
ws.EnableOutlining = True

This is ok but When close the workbook and reopen it, my sheet becomes fully protected and i cant use the group icons. Can anyone either suggest better code or a way to initilise the workbook to act in this way when it loads up. For Reference Below is my full

Sub ProtectAll()
Dim ws As Worksheet
sSheet = Control.Name
For Each ws In ThisWorkbook.Worksheets
Select Case ws.Name
Case sSheet1
Case Else
ws.Protect Password:="PASSWORD", userinterfaceonly:=True
ws.EnableOutlining = True
End Select
Next ws
End Sub

View 2 Replies View Related

Protected Sheets With Macros Giving Runtime Error 1004

Mar 3, 2009

I created several macros objects to do simple hide columns, filter on, filter off, etc. type functions, using the Tools / Record Macro feature. Then discovered they won't work in a protected worksheet. Is there a way around this situation, other than turning protection off? Here's an example of the code for one of them, although I get the error or every attempt to perform a macro once the sheet is protected:

View 4 Replies View Related

Change VBA To Password Protect All Sheets To Allow User To Select Protected

Apr 8, 2009

I need to change VBA to Password Protect all sheets to allow user to select protected. I have:

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved