Deleting a range after selecting a sheet
I have a button on a worksheet that when pressed is supposed to:
1. Go to another worksheet in the same workbook 2. Select a range of cells in that worksheet 3. Delete the selected range of cells However I am getting the following error message: "Select method of Range class failed" when the code executes -- Range(selRange).Select-- Can someone inform me of how I can fix this? Thanks in advance The code segemnt is below ------------------------------------ selEnd = readRow - 1 selRange = "A" + Trim(Str(selBegin)) selRange = selRange + ":" + "F" + Trim(Str(selEnd)) Sheets("Shared Emp Master Sheet").Select Range(selRange).Select <- ERROR OCCURS HERE Selection.Delete Shift:=xlUp ------------------------------------ |
Deleting a range after selecting a sheet
Hi
Replace Str with Cstr and you need Sheets("Shared Emp Master Sheet").Activate Range(selRange).Select Selection.Delete Shift:=xlUp better still do Sheets("Shared Emp Master Sheet").Range(selRange).Delete Shift:=xlUp regards Paul On Feb 25, 3:27*pm, wrote: *I have a button on a worksheet that when pressed is supposed to: 1. Go to another worksheet in the same workbook 2. Select a range of cells in that worksheet 3. Delete the selected range of cells However I am getting the following error message: "Select method of Range class failed" when the code executes -- Range(selRange).Select-- Can someone inform me of how I can fix this? Thanks in advance The code segemnt is below ------------------------------------ selEnd = readRow - 1 selRange = "A" + Trim(Str(selBegin)) selRange = selRange + ":" + "F" + Trim(Str(selEnd)) Sheets("Shared Emp Master Sheet").Select Range(selRange).Select * * * *<- ERROR OCCURS HERE Selection.Delete Shift:=xlUp ------------------------------------ |
All times are GMT +1. The time now is 01:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com