• 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

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
 
Last edited by a moderator:
Thank you in advance for your help. I do not understand how to move a post and would have appreciated assistance or guidance on that. You can delete my post I will take my question somewhere else.
 
JanineStaunton
This thread is Your original thread - okay?
You opened new thread and copied this to there (= duplicated and now closed).
You continue with this thread - okay?

> How to move ...
As You have read from forum rules: How to get the Best Results at Chandoo.org Please post, new posts in the correct forums
then no need to move ( try to do correct selections before to post ).
If mistake has happened then

one possible could be from right top corner ... if You can do it
Screenshot 2019-10-24 at 08.56.01.png
... or ...
ask moderator to move Your thread to correct forum.
 
Hi ,

Let us leave aside the issue of copying / moving the post.

If you can upload a sample workbook , with some data in it , and tell us exactly what you want to do , the code to do that can be posted.

You need to tell us :

1. The origin of the copy section ; which portion of which worksheet needs to be copied.

2. The destination point ; which cell in which worksheet will be the point where the copied portion will be pasted.

3. Will this be a simple paste or does it need to insert the copied cells , pushing existing data downwards , rightwards ,... ?

4. Will the origin mentioned in (1) above always be the same ? If not , how do we identify it each time ?

5. Will the destination point mentioned in (2) always be the same ? If not , how do we identify it each time ?

Anything else you think will help us understand the problem.

Narayan
 
Back
Top