I don't think you have included all the code and some of the code you have included looks quite odd.
Perhaps tell us what you are trying to do ?
Some of the odd looking code is:
Offset(0 1) > would expect a comma between the 0 and 1
Range(Selection Selection.End(XlUp)).Select > ??? not to mention that it is followed by an XlDown.
Hi Alex, thanks for the reply.… Not sure why the comma didn't show up when I pasted it; it's still in the code in VBA though.
I have two workbooks: A SOURCE workbook that has a “Cover Page” tab where a vendor’s name (in Cell
C6) is copied then pasted in a DESTINATION workbook, Cell
B6, beside (
to the left of) every row of data that that currently exists without a vendor name (
and only in those rows).
Below is that section of code and it's entirety:
Sub SUPPLIER_NAME_Fill_down_based_on_the_adjacent_row()
Dim LastRow As Long
LastRow = Range("B" & Rows.Count).End(xlUp).Row
Dim FileToOpen As Variant
Dim OpenBook As Workbook
Application.ScreenUpdating = False
FileToOpen = Application.GetOpenFilename(Title:="Browse for your file & Select it", ButtonText:="Choose SAME SUPPLIER Dec' Sheet AGAIN")
If FileToOpen <> False Then
Set OpenBook = Application.Workbooks.Open(FileToOpen)
OpenBook.Sheets("Cover Page").Range("C6").Copy
'FIBER
ThisWorkbook.Activate
Worksheets("Fiber data").Select
'(From Below, Go To) Last SUPPLIER-occupied Cell
Range("B2000").End(xlUp).Select
'Last occupied Cell + 1 Row Dn
ActiveCell.Offset(1, 0).Select
'Paste Supplier Name Once
ActiveCell.PasteSpecial xlPasteValues
'(From Below, Go To) Last APN-occupied Cell
Range("C2000").End(xlUp).Select
'Last occupied Cell & 1 Col Left
ActiveCell.Offset(0, -1).Select
'PLACE HOLDER
Selection.Value = "*"
'RANGE -- up to (& including) Supplier just pasted (Did not "select" --for some reason, so the next code of the same type will be a redundancy)
Range(Selection, Selection.End(xlUp)).Select
'Selection.AutoFill Destination:=Range("B466:B" & Range("C" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial xlPasteValues
'PLASTIC,COATING,ADHESIVE
Worksheets("Plastic,Coating,Adhesive data").Select
'(From Below, Go To) Last SUPPLIER-occupied Cell
Range("B2000").End(xlUp).Select
'Last occupied Cell + 1 Row Dn
ActiveCell.Offset(1, 0).Select
'Paste Supplier Name Once
ActiveCell.PasteSpecial xlPasteValues
'(From Below, Go To) Last APN-occupied Cell
Range("C2000").End(xlUp).Select
'Last occupied Cell & 1 Col Left
ActiveCell.(0, -1).Select
'PLACE HOLDER
Selection.Value = "*"
'RANGE -- up to (& including) Supplier just pasted (Did not "select" --for some reason, so the next code of the same type will be a redundancy)
Range(Selection, Selection.End(xlUp)).Select
'Selection.AutoFill Destination:=Range("B466:B" & Range("C" & Rows.Count).End(xlUp).Row)
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial xlPasteValues
End If
MsgBox "Kindly Check out the Newly Created SYNTHESIS File!
", vbOKOnly, "DONE!"
Application.ScreenUpdating = True
End Sub