• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Assistance with VBA code relating to copying of data

Status
Not open for further replies.

JanineStaunton

New Member
Hello Everyone,

My name is Janine and I am from South Africa. I work as a senior accountant in the Fuel Retail Sector, and have alot of repetitive tasks that I do daily. I get Text files from the Retail Site and I then import these into excel.
I managed to write a very basic simple Macro that automates this for me. PS: I am very new to this and is currently doing an online course in VBA and Macros. I am not done yet but I am applying it already in my work.

I have difficulty understanding Absolute and relative referencing. So my daily text do not have the same amount of rows every day. The text file is a summary of the previous day's sales and if an item from a certain category were not sold that line will not be part of the text file. What is the correct way to write the code to select all the rows in the text file to copy to my workbook?

Below is what my current code looks like - please help me with what I am missing? I tried for days and finally found the courage to join a forum for help.

Code:
Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Range("A1").Select
    Windows("Day End Summary.RPT").Activate
    Range("A11").Select
    Range(Selection, Selection.End(xlDown)).Select
    ActiveCell.Range("A1:E28").Select
    Selection.Copy
    Windows("Engen Middelvlei Daily Sales Summary.xlsm").Activate
    ActiveCell.Select
    ActiveSheet.Paste
    ActiveWindow.SmallScroll Down:=3
    ActiveCell.Offset(0, -2).Range("A1").Select
End Sub
 
Duplicated with:
This is closed.
 
Status
Not open for further replies.
Back
Top