Locking cells on Excel

Hi all

I just wondered if there was a way to use UiPath to lock certain columns in Excel, e.g. lock A through R and leave S unlocked?

Thanks :slight_smile:

@Short

You need to go with writing a macro/vba for it and then Invoke it

Cheers

Hey

Do you know what the VBA code for it would be please? I’ve tried looking and nothings working

In addition to using vba or vbscript, you can also interact with the menu ribbon features using keystrokes, which I’ve had success in doing it:
image

TypeInto ralt+“rps”
TypeInto “password”
SendHotkey Alt+m
etc…

EDIT: and use Select Range prior to those interactions

1 Like

@Short

Sub(Rangevar as String)
      ActiveSheet.Range(Rangevar).Locked = True
End Sub

for your case you can pass range as A:R

Also make sure to protect the workbook first only then lock will work

cheers

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.