How do I attach my file..?
How do I attach my file..?
Last edited by RAJESH SHAH; 11-26-2021 at 03:31 PM.
Welcome to the forum
Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.
Remember to desensitize the data.
Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
I have attached my sample file along with this message.
This sheet contains data in different columns. As the cells contain formulas, I am trying to copy the data to the sheet “Copy” with the help of paste special > values. The columns containing the amounts may be different in different cases. Sometimes I have to select the data from A:F in this case and sometimes it is up to 31 columns or more. How do I copy the data with date to the sheet “Copy” with the help of a code.?
This code gives me the correct answer if the data is in columns A: AE(31 columns), but in a different scenario if the columns are less than that I get an error but the code has given the right solution. How can I avoid that error.? I am getting an error at this line of cide. (Run Time Error 1004). Please note: I am getting the required solution after I press end in the error box. I just want to avoid the error message.
With .Range(Cell.Offset(1), Cell.End(xlDown))
.Copy Sheets("Daily").Range("B" & Rows.Count).End(xlUp).Offset(1)
Cell.Copy Sheets("Daily").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Count)
End With
Last edited by RAJESH SHAH; 11-25-2021 at 05:45 PM.
Option Explicit
Dim Cell As Range
Sub Append()
Sheets("Extract").Select
Range("A1:AE619").Select
Selection.Copy
Sheets("Copy").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A1:AE1").Select
Application.CutCopyMode = False
Selection.NumberFormat = "m/d/yyyy"
Range("A1").Select
Dim Cell As Range
Sheets("Copy").Select
With Sheets("Copy")
For Each Cell In .Range("A1", .Cells(1, Columns.Count).End(xlToLeft))
With .Range(Cell.Offset(1), Cell.End(xlDown))
.Copy Sheets("Daily").Range("B" & Rows.Count).End(xlUp).Offset(1)
Cell.Copy Sheets("Daily").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Count)
End With
Next Cell
End With
Sheets("Daily").Select
Range("A2").Select
End Sub
This is the full code. I didn't save the sheet as xlsm. Hence, the code must have not been uploaded
How far does this get you?
Can you please explain what yuo want to accomplish with this.Please Login or Register to view this content.
Please Login or Register to view this content.
Attachment 756936
Last edited by jolivanes; 11-26-2021 at 03:15 AM.
Thanks for the response Jolivanes. First, I am trying to copy the data from sheet Extract to Sheet Copy. To remove the formula from sheet Extract I am using Paste Special > values. Then I am seperate the dates and amounts of the whole data in 2 columns in sheet Daily vertically. If you have run the code I shared, you will see an error. If you check the result, I mean the total of all amounts in Extract and match with Daily it is matched.
I don't run code that does not work properly.
You don't need sheet "Copy" to copy and paste values from the 2nd row in sheet "Extract" to sheet "Daily"
So again I ask, what do you want to do?
Copy values from Columns A and B from the 2nd row down in sheet "Extract" and paste in sheet "Daily"? To where in sheet daily?
I want to copy the values from Extract and paste in sheet "Daily", Dates in Column A2 and Amount in column B2 but without the formula. Check this sample file
Last edited by RAJESH SHAH; 11-26-2021 at 02:25 AM. Reason: attaching file
Before I run the code the sheets Copy and Daily are blank. The sheet Extract only contains data. Delete the contents of Copy and Daily and then run the code. You will understand what I am trying to achieve.
GTG. Will be back in around 4 hours.
This assumes, as you mentioned, that sheet "Daily" is empty.
You don't need sheet "Copy", straight from one sheet into the other.
You see now how important it is to attach a workbook with before and after.
It's not only you that GTG, I am going to get my beauty sleep.Please Login or Register to view this content.
Let us know if this does what you want, and remember the attachment from Post #5.
Last edited by jolivanes; 11-26-2021 at 03:17 AM.
Jolivanes. I am learning accounts at a CA office where they do a lot of work manually. Being aware what excel can do, I try new ways to make the work easier and faster. After I learn and understand each topic fully, I try to create small application which will help in getting days of work in minutes. This is one of them. This work takes around 10 days to complete it manually. I am trying to create an app where it could be done in one hour. As I am new to coding, I try and write a few codes but when the codes are too complicated to write, I get help from the excel forums. I can get the code written through commercial services but I would miss the fun of learning and creating.
Regarding this project, I have created 8 macros with 7 different sheets, all the macro buttons placed in the first sheet. Since, I am getting an error in one of the sheets, I will not able to hide and protect the sheets which would be my next step, So, the code you shared is working perfectly except that I didn't mention that the Extract sheet contains amounts in the 621, 622 and 623 rows. Sorry about that. Row 621 is the sum of total in rows 2 to 619, row 622 is the exact total expected from cell 2 to 619 (result of a formula) and row 623 is the difference if any between 621 and 622. So, in your code if you select the data from each column from cell 2 to cell 619 then I would get the perfect match. If this code works, my project will be as good as over. I have marked cells yellow in the Daily Sheet for your reference.
Sorry once again, I didn't share the entire details. My mistake.
Is this done to check if all the data from the one sheet has been transferred to the other sheet?
If so, that is not needed as that is what the code does. However, it is no problem adding that in.
You mention that Row 621 is the sum of Column B. I assume that that should be "below the last cell" in Column B as the columns in Sheet "Extract" can be of different lengths and consequently the length of Column B is not always the same.
Is that so?
The length of the amounts at any time can be only up to Row 619 or less in each column. It should not take the amount of Row 621 onwards.
This is why I used this formula...
For Each Cl In .Range("A1", .Cells(1, Columns.Count).End(xlToLeft))
With .Range(Cl.Offset(1), Cl.End(xlDown))
.Copy Sheets("Daily").Range("B" & Rows.Count).End(xlUp).Offset(1)
Cl.Copy Sheets("Daily").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(.Count)
End With
Next Cl
This was for copying the data from Extract - Copy - Daily
From the copy sheet the last 3 columns 621, 622 and 623 were not copied. Hence I used to get the Daily data without the totals.
Did you read the attachment in Post #5?
Change this line
to thisPlease Login or Register to view this content.
If you sum the values of Column A, where do you want that pasted? And what about the other Columns?Please Login or Register to view this content.
For Column A, should that not be in Cell C17 in "Daily" sheet?
And for Column B in C23?
Perfect. Thanks a ton Jolivanes. About attachment #5, I already explained in attachment #13. Is there something else other than that.? I have to hide some of the sheets and protect the macro so that it may not be altered by mistake by the user. That I think I will do it. Thanks once again.
The attachment is about using code tags, nothing else.
If that's it, good luck and stay safe.
BTW, if you want the sum of each column in Column C of "Daily" sheet, use this code.
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks