In folder X, I have 2 excel files from column A to column H. Now I want to delete the unnecessary columns B: D, F, H in both excel files of the folder. How to write VBA code, so that when running the code, a message box will appear looking for the X directory address (or you can enter the X directory path directly into the code)
Sub deletecolumn() Dim MyFolder As String Dim MyFile As String Application.DisplayAlerts = False Application.ScreenUpdating = False MyFolder = "E:\Exp" MyFile = Dir(MyFolder & "\*.xlsx") Do While MyFile "" Set OpenBook = Application.Workbooks.Open(MyFolder & "\" & MyFile) OpenBook.ActiveSheet.Range("B:D,F:F,H:H").Delete OpenBook.ActiveSheet.Range("A1").Select MyFile = Dir OpenBook.Close SaveChanges:=True Loop Application.ScreenUpdating = True End Sub
can pls help on this Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Range("A1") "" Then Range("A1").Select Selection.AutoFill _ Destination:=Range("A1:A5"), Type:=xlFillDefault 'Range("H1").Value = "=IF(AND(F5="",G5="",H5="")),"",(I4+F5-G5-H5)" End If 'End With End Sub
Sir, Good Logic
Awesome tutorial👍
Thank you so mutch Sir.
You are most welcome
Sir make a video on live data from a source and make a excel with different time intervals automatically
Will try
Is there a video to validate data from a known list? I want an error message for invalid part number without using a drop down menu.
In folder X, I have 2 excel files from column A to column H. Now I want to delete the unnecessary columns B: D, F, H in both excel files of the folder. How to write VBA code, so that when running the code, a message box will appear looking for the X directory address (or you can enter the X directory path directly into the code)
Sub deletecolumn()
Dim MyFolder As String
Dim MyFile As String
Application.DisplayAlerts = False
Application.ScreenUpdating = False
MyFolder = "E:\Exp"
MyFile = Dir(MyFolder & "\*.xlsx")
Do While MyFile ""
Set OpenBook = Application.Workbooks.Open(MyFolder & "\" & MyFile)
OpenBook.ActiveSheet.Range("B:D,F:F,H:H").Delete
OpenBook.ActiveSheet.Range("A1").Select
MyFile = Dir
OpenBook.Close SaveChanges:=True
Loop
Application.ScreenUpdating = True
End Sub
👌👌
sir please give the vba code export excel range to png jpg format high resolation 300dpi and 600 dpi
Will upload soon
Thanks
Welcome
can pls help on this Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Range("A1") "" Then
Range("A1").Select
Selection.AutoFill _
Destination:=Range("A1:A5"), Type:=xlFillDefault
'Range("H1").Value = "=IF(AND(F5="",G5="",H5="")),"",(I4+F5-G5-H5)"
End If
'End With
End Sub