I have the script working perfectly for me, but would like to take it to the next level. This script will check B3 cells and on for a value. If it has a value, it will copy the value in K column and paste it in a batchfile. What I need to figure out is how can the one script, select and copy column K, L, and M instead of just K. This is the script:
Sub Tester()
Dim LastCell As Range
Dim ColumnDiff As Long
Dim newusers As String
'Setting the Offset
ColumnDiff = ActiveSheet.Columns("K").Column
ColumnDiff = ColumnDiff - ActiveSheet.Columns("B").Column
'Select, Copy, Paste
With ActiveSheet
Set LastCell = .Range("b3").End(xlDown)
.Range("B3", LastCell).Offset(0, ColumnDiff).Select
Selection.Copy
newusers = Shell("C:\Windows\notepad.exe
\\Sharing200\users\newusers.bat", vbNormalFocus)
SendKeys "^v"
SendKeys "^s"
I have tried ColumnDiff = ActiveSheet.Columns("K:M").Column, but that wasn't right.