• 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.

count the total no. of rows

Status
Not open for further replies.

r@1234

Member
vba will be placed in a seperate file macro.xlsm
i have 1.xls it has data
dont count the first row of 1.xls
i need a macro that will count the total no. of rows that has data and paste it to I1
plz see the sample file
i need the vba to do the same
 

Attachments

  • 1.xls
    31 KB · Views: 7
The macro will not be in the workbook that will receive the data or the workbook where the data will be copied from. Right.
Are both workbooks where the data is in and where the data will be pasted into open?
One is named 1.xls I take it but what is the workbook named where the data will be pasted into?
Why do want to count the number of rows? Why not just copy and paste. You don' need to count to copy. Unless you need that number for something else.
Do I read that right. Paste in Cell L1 (=row 1 and column 12) and on down.
Is the workbook that you paste into also an .xls type workbook or an .xlsm type?
 
If all three workbooks are open, workbook "Macro.xls" has the code in it, workbook "1.xls" has the data in sheet "1-sheet1" and workbook "Junkfile.xls" will get the data stating at cell L1 in Sheet1 (Change as required.)
Code:
Sub Maybe()
    Dim wb1 As Workbook, wb2 As Workbook
    Set wb1 = Workbooks("1.xls")     '<---- copy from here
    Set wb2 = Workbooks("JunkFile.xls")      '<----paste into here
        wb1.Sheets("1-Sheet1").UsedRange.Offset(1).Copy wb2.Sheets("Sheet1").Range("L1")
End Sub
 
I have not mentioned mam that there are three workbooks
Code:
Sub Maybe()
    Dim wb1 As Workbook
    Dim Ws1 As Worksheet
    Set wb1 = Workbooks.Open("C:\Users\WolfieeeStyle\Desktop\1.xls")
    Set Ws1 = w1.Worksheets.Item(1)
    With Ws1
     Ws1.UsedRange.Offset(1).Copy Ws1.Sheets("Sheet1").Range("L1")
      
      
End Sub

i have corrected the code but after that also something is missing plz have a look and correct the details after
With Ws1
Mam Plz Have a rellok and do needful
Thnx Alot Mam for showing ur Great interest in solving the same
 
Yes Rahul see the first post of this thread i attached sample file with result also plz see
& yes Joli Mam u shared the link to me for what purpose? i couldnt understand
 
Re: I have not mentioned mam that there are three workbooks
And the names of these workbooks will be kept a secret otherwise I would have mentioned them.
 
Jolivanes what happened
what is going on
I think i am seeing a dream or u r in a dream
If u have doubt then u can ask me clearly i will tell u the truth but tell me clearly and openly
 
I am trying to let you know that you have to explain your situation properly. You know the situation, like that you have multiple workbooks, but we don't know that. Like you know now, that was never mentioned until after a solution to your first post was given. I don't think that people that are trying to help you should have to keep on asking questions about your situation. That is entirely up to you.
 
Now i understood what happens i actually didnt mentioned the details in the sample file
i actually mentioned all the details to the sample file but i uploaded the sample file without mentioning the details
Now i got ur point
Sorry Joli for the same but u said three file and u consider L1 then i gone mad about it how u got that details
Sorry Joli
I will catch u in some time afer solving a problem if that has been solved then no need for this macro and if it is not solved then i need ur help
Relax and chill
Have a Great Day Mam tc
 
Re: Joli Mam u shared the link to me for what purpose? i couldnt understand
If you read the posts in that thread you'll see that it pertains to copying data from 3 closed workbooks.
If your workbooks are not closed somewhere in a folder, mention that and it'll be no problem to change.
Of course the way to go forward is to read the code, see if you understand what it does, maybe change some things that you think should be changed in order for it to work for your case. If it does not work the way it should, ask here for someone to change it to fit your specific needs.
 
r@1234
Continue with this Your original thread

This thread is closed now.
 
Status
Not open for further replies.
Back
Top