HI,
can someone explain me this code?
![]()
Please Login or Register to view this content.
HI,
can someone explain me this code?
![]()
Please Login or Register to view this content.
Last edited by extremis; 08-09-2013 at 10:42 AM.
It finds the first blank cell in column A on a worksheet and pastes values to it.
What is pasted and what sheet it's pasted will be determined in the preceding lines of code.
If posting code please use code tags, see here.
/e My mistake I misread the OP.
Last edited by Solus Rankin; 08-09-2013 at 10:06 AM.
Thanks,
Solus
Please remember the following:
1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.Highlight the code in your post and press the # button in the toolbar.2. Show appreciation to those who have helped you by clickingbelow their posts.
3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.
"Slow is smooth, smooth is fast."
The syntax for Cells() is cells(row number, column) so the above code references Cells(however many rows are in my sheet, column A)![]()
Please Login or Register to view this content.
".End(xlUp)" tells excel to move from the row number you earlier specified, upward, until it finds a cell with contents. it basically selects the last used cell in the specified column (column A)
This says "move one row down from Cells(however many rows are in my sheet, column A) and paste only the values from the range that was previously copied."![]()
Please Login or Register to view this content.
Last edited by LaffyAffy13; 08-09-2013 at 10:10 AM.
~~LaffyAffy13~~
If I have helped you solve your problem, please be sure to clickat the bottom left of my post.
Thanks.
so basicly...if i have a blank space in column A, then copy the value from "where you reference is''
???
I don't know what that says. Regardless of your blank spaces in column A, the line of code you posted will undoubtedly find the last cell in Column A that has been used, and paste the information directly below it.so basicly...if i have a blank space in column A, then copy the value from "where you reference is''
Last edited by LaffyAffy13; 08-09-2013 at 10:16 AM.
Not quite.
It doesn't find any blank cell in column A.
The code finds the first blank cell in column A and copies to there.
Not any blank space, but the bottom row. If you currently use 900 rows it will place it in 901. If you have 9000 rows it will place it in 9001.
If row 300 is blank but you have data in 301-500 it will place it in row 501.
Yes, what Solus said.
Alright, thanks....So it can be useful to fill a space between rows right?
Like
11
Blank
22
Right?
For that it might be easiest to loop through the column to find the first blank row.
No.
If you had data like that the code would find the cell under 22, not the blank cell.
To fill in blanks take a look at SpecialCells(xlCellTypeBlanks).
It won't be useful for filling in spaces between rows that currently have data.
![]()
Please Login or Register to view this content.
Last edited by Solus Rankin; 08-09-2013 at 10:26 AM. Reason: edit code
Alright...
but it's only useful to fill thre last cell of a range of data?
XeRo
What are you pasting in that code?
Also where is Row defined?![]()
extremis
It's not only used to fill the last cell with data.
You could be pasting a whole chunk of data.
For example you might be consolidating data on multiple sheets onto one sheet.
Using the code you posted you can append the data from each sheet below the data that's already there.
I'm pasting two white bunnies in a snow storm![]()
That's what I thought.![]()
Norie, if you're talking about ".Row", that just refers to the row's number. So he's all good. As for the pasting, maybe its two white bunnies in a snowstorm?
thanks for your help...helped a lot
![]()
It would only paste if the clipboard was pre-loaded.
@ Laffy...
He was pointing out a typo. It should be rows.count. Rows the collection.
XeRo
I know, it pasted an entire Change sub into A2 when I ran it after changing Row to Rows.![]()
Good thing it wasn't in the ws change event then :D
Oh, that makes sense. You must have edited it before I saw the problem. Yay for teamwork :D
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks