Uploaded August 2019 | Updated September 2026, 2 weeks ago
How to copy non adjacent cells data from multiple workbooks and paste into a master workbook automatically using VBA.
Here's the complete VBA code. Angular brackets are replaced with 'Not Equal To':
Sub copyNonAdjacentCellsData()
Dim myFile As String, path As String
Dim erow As Long, col As Long
path = "c:\copy-non-contiguous-cells-data\"
myFile = Dir(path & "*.xlsx")
Application.ScreenUpdating = False
Do While myFile Not Equal To ""
Workbooks.Open (path & myFile)
Windows(myFile).Activate
Set copyrange = Sheets("sheet1").Range("E9,C13,B7,E3,B18")
Windows("master-wbk.xlsm").Activate
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
col = 1
For Each cel In copyrange
cel.Copy
Cells(erow, col).PasteSpecial xlPasteValues
col = col + 1
Next
Windows(myFile).Close savechanges:=False
myFile = Dir()
Loop
Range("A:E").EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
Complete details available at our website: exceltrainingvideos.com/copy-non-adjacent-cells-data-from-multiple-workbooks
How to copy non adjacent cells data from multiple workbooks and paste into a master workbook automatically using VBA.
Here's the complete VBA code. Angular brackets are replaced with 'Not Equal To':
Sub copyNonAdjacentCellsData()
Dim myFile As String, path As String
Dim erow As Long, col As Long
path = "c:\copy-non-contiguous-cells-data\"
myFile = Dir(path & "*.xlsx")
Application.ScreenUpdating = False
Do While myFile Not Equal To ""
Workbooks.Open (path & myFile)
Windows(myFile).Activate
Set copyrange = Sheets("sheet1").Range("E9,C13,B7,E3,B18")
Windows("master-wbk.xlsm").Activate
erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
col = 1
For Each cel In copyrange
cel.Copy
Cells(erow, col).PasteSpecial xlPasteValues
col = col + 1
Next
Windows(myFile).Close savechanges:=False
myFile = Dir()
Loop
Range("A:E").EntireColumn.AutoFit
Application.ScreenUpdating = True
End Sub
Complete details available at our website: exceltrainingvideos.com/copy-non-adjacent-cells-data-from-multiple-workbooks









![Whatsapp Desktop Automation with VBA
How to automate Whatsapp Desktop to login, search for user, send message and attachment and logout.
Heres the complete macro or VBA code:
Option Explicit
Dim driver As New WebDriver
Sub LoginSearchUserSendMessageAttachmentViaWhatsapp()
Chrome Driver
Selenium
Selenium Wrapper
Dim keys As New SeleniumWrapper.keys
Dim filepath As String
filepath = C:exceltrainingvideos-12find-header-with-todays-date.xlsm
driver.Start chrome
driver.Get https://web.whatsapp.com/
driver.Window.Maximize
driver.Wait 5000
driver.Wait 2000
driver.FindElementByXPath(//span[@title = Dt]).Click
driver.Wait 1000
driver.SendKeys (keys.Tab + keys.Tab)
driver.Wait 1000
driver.SendKeys (Poonam Mobile)
driver.Wait 1000
driver.SendKeys (keys.Enter)
driver.FindElementByClass (_3FRCZ)
driver.SendKeys (Please study *the below attached file* for the class tomorrow.)
driver.Wait 1000
driver.SendKeys (keys.Enter)
driver.Wait 2000
driver.FindElementByXPath(//div[@title=Attach]).Click
driver.Wait 10000
driver.FindElementByXPath(//input[@accept=image/*,video/mp4,video/3gpp,video/quicktime]).SendKeys (filepath)
driver.Wait 2000 this wait time depends on the size of your file max 64 mb
driver.FindElementByXPath(//span[@data-icon = send]).Click
driver.Wait 1000
driver.FindElementByXPath(//div[@title = Menu]).Click
driver.FindElementByXPath(//div[@title=Log out]).Click
driver.Quit
End Sub Whatsapp Desktop Automation with VBA](https://i.ytimg.com/vi/kYcbEGYCABE/mqdefault.jpg)
