Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, I am trying to get my macro to delete a particular column when the first
row of that column contains a certain keyword, however I am only able to delete the first row of that column. In addition, how come " Workbooks.Open Filename:=fi" keeps giving me error 1004 - runtime error that says it can't find the file? Sub redundantCols() Dim fi As String, sh As String Dim c As String Dim i As Integer, j As Integer, k As Integer fi = InputBox("Enter the name of file", "Source file") sh = InputBox("Enter the name of the sheet", "Source sheet") fi = fi & ".xls" Workbooks.Open Filename:=fi Windows(fi).Activate Sheets(sh).Select With Workbooks(fi).Worksheets(sh) .Cells(1, 9) = "Item Description" i = 1 For j = 1 To 16 c = Cells(i, j) If c = "Description" Or c = "Item" Then .Cells(i, j) = "" End If Next j End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete columns if 0 | New Users to Excel | |||
Delete Columns | New Users to Excel | |||
merge text from 2 columns into 1 then delete the old 2 columns | Excel Worksheet Functions | |||
I can't delete columns - help! | Excel Worksheet Functions | |||
Delete columns | Excel Programming |