Jump to content

WORKSHEET - find and replace script


Recommended Posts

Hello,

 

Recently I came across this useful script (made by @Pat Stanford) and I would really like to use it as a way to replace outdated layer name in criteria for many my spreadsheet cells within one worksheet. 

Can this script work with multiple cells selected, or it only function with one cell at the time?

 

And is there around maybe updated version of script to more recent software versions?

 

Thanks.

 

Here is a script:

Var

S1,S2,S3 :String;
N1 ,N2,N3,N4,N5,N6,N7 :Integer;
H1 :Handle;


Begin
S1:=StrDialog('Enter Substring to Find','Loc1');
S2:=StrDialog('Enter Substring to Replace With', 'Loc2');

H1:=GetTopVisibleWS;
GetWSSelection(H1,N5,N5,N1,N2,N5,N3,N4,N5);

For N5:=N1 to N3 do
Begin
For N6:=N2 to N4 do
Begin
GetWSCellFormula(H1,N5,N6,S3);

N7:=Pos(S1,S3);
If N7 <> 0 then
Begin
Delete(S3,N7,Len(S1));
Insert(S2,S3,N7);
SetWSCellFormula(H1,N5,N6,N5,N6,S3);
end;
end;
end;
ClrMessage;

END;

Run(FindandReplaceInWorksheet);

 

Edited by drelARCH
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...