Delete Single Cell - VBS

Is there a way to delete a SINGLE CELL in an Excel worksheet using VBS?  I want it to delete the cells and move whatever data is to the right of it into that cell.

I've searched around, but it appears you can only delete ROWs.  If that's the case, I'll have to draft the logic that moves the cell contents to the left.

Thanks for whatever help you can be.
BMITAsked:
Who is Participating?
 
RobSampsonCommented:
Hi, in VBS, this should work.

Regards,

Rob.
Const xlToLeft = -4159
Set objExcel = CreateObject("Excel.Application")
Set objWB = objExcel.Workbooks.Open("C:\MyBook.xls", False, False)
Set objSheet = objWB.Sheets(1)
objSheet.Range("C3").Delete xlToLeft

Open in new window

0
 
BMITAuthor Commented:
An eloquent and articulate answer.  I had forgotten that you had to use .Range to delete cells, even if single ones.

Thanks.
0
 
RobSampsonCommented:
No worries. Thanks for the grade.

Rob.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.