We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
'sExcel is the full path of the Excel file. Public Sub FixExcel(sExcel as String) Dim xlApp As Object Dim xlBook As Object Dim xlSheet As Object Dim cell As Object Dim Range As Object Set xlApp = CreateObject("Excel.Application") 'Opens Excel TEMPlate always from the C:\ to reduce traffic Set xlBook = xlApp.Workbooks.Open(sExcel) Dim k as Long Dim sRange, sRange2 as String k = 8 sRange = Col_Letter(k) sRange2 = Col_Letter(16) With xlApp ' deletes columns 8 through 16 For Each cell In Range(sRange & ":" & sRange2) If cell.MergeCells = True Then cell.UnMerge cell.EntireColumn.Delete Shift:=-4159 'xlToLeft End If Next End With xlBook.Save xlBook.Close Set xlBook = Nothing Set xlApp = Nothing End Sub Function Col_Letter(ByVal ColumnNumber As Long) As String If ColumnNumber > 26 Then ' 1st character: Subtract 1 to map the characters to 0-25, ' but you don't have to remap back to 1-26 ' after the 'Int' operation since columns ' 1-26 have no prefix letter ' 2nd character: Subtract 1 to map the characters to 0-25, ' but then must remap back to 1-26 after ' the 'Mod' operation by adding 1 back in ' (included in the '65') Col_Letter = Chr(Int((ColumnNumber - 1) / 26) + 64) & _ Chr(((ColumnNumber - 1) Mod 26) + 65) Else ' Columns A-Z Col_Letter = Chr(ColumnNumber + 64) End If End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Copy one row (from Word) into one cell||14||51|
|Pull data from another table from datalist in aspx.net, vb||2||16|
|Excel VBA to convert a string into a formula||19||16|
|Sort columns by the column header Excel 2016 VBA||5||15|
Join the community of 500,000 technology professionals and ask your questions.