In "Sheet 1" name of the worksheet, starting column and ending column mentioned. Need to delete based on the input of all sheets.
In "Sheet 1" name of the worksheet, starting column and ending column mentioned. Need to delete based on the input of all sheets.
Last edited by cpramesh; 06-02-2017 at 02:04 AM.
Am no VBA expert, but this seems to work
![]()
Sub DelColumns() lastrow = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row For i = 2 To lastrow ShtNm = Worksheets("Sheet1").Cells(i, 1) ColFrm = Worksheets("Sheet1").Cells(i, 2) ColTo = Worksheets("Sheet1").Cells(i, 3) Worksheets(ShtNm).Range(ColFrm & ":" & ColTo).Delete Next i End Sub
Regards
Special-K
Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.
Not sure of what you're after? Does this help?
![]()
Sub cprameshz() Dim i As Long With Sheets("Sheet1") For i = 2 To .Range("A" & Rows.Count).End(3).row Sheets(.Cells(i, "A").Value).Columns(.Cells(i, "B") & ":" & .Cells(i, "C")).Delete Next i End With End Sub
John your code is working well. Thank you
You're welcome. Glad to help out and thanks for the feedback.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks