Went from a single cell --> Range("B" & r) which was working fine, to multiple cell --> Range("B" & r & ":D" & r) and now getting a type mismatch error. Not sure why... Your help is appreciated!
![]()
Please Login or Register to view this content.
Went from a single cell --> Range("B" & r) which was working fine, to multiple cell --> Range("B" & r & ":D" & r) and now getting a type mismatch error. Not sure why... Your help is appreciated!
![]()
Please Login or Register to view this content.
Last edited by Mr_Ekid; 07-17-2015 at 03:43 PM.
Hi, Mr E,
Please take a few minutes to re-read the forum rules, and then edit your post to add CODE tags.
Thanks.
Last edited by shg; 07-09-2015 at 01:50 PM.
Entia non sunt multiplicanda sine necessitate
Fixed, apologies.
Thank you.
Maybe (untested):
![]()
Please Login or Register to view this content.
Last edited by shg; 07-09-2015 at 02:04 PM.
This copies the first row in all rows down to iRow. Upon looping to a row with data entered, it should not replace existing data. Thoughts?
I created a work around by adding three separate loops for each column, but I figured there should be a way to execute this with less code. See below:
![]()
Please Login or Register to view this content.
Yes -- explain clearly in words and sentences what you have and what you're trying to do.Thoughts?
A workbook with before and after examples would help.
Last edited by shg; 07-16-2015 at 12:14 PM.
Given: B:D column of first row in loop (row 6 in last code snippet) will always have contain data (Xb,Xc,Xd in example file).
Run Loop, Repeat to last row: If current cell range ("B"Row:"D"row) has no content, then copy contents of row-1 (the above row) and paste into current range ("B"Row:"D"row). If cell range contains data, do nothing. Loop to next row.
Per attached file: code will identify that row 6 is populated, do nothing, and move to row 7. Row 7 being empty, will have row 6 copy/pasted into row 7. Row 8 being empty will have row 7 copy/pasted into row 8, etc., until row 10 where the code will again, do nothing. Row 11 being empty,will have row 10 copy/pasted into row 11, etc.
My original code accomplished only one column: (Col B)
I tried to add Col B:D by rewriting the following:![]()
Please Login or Register to view this content.
This gives me a type mismatch error. I wanted to understand why & to clean up code.![]()
Please Login or Register to view this content.
Example file attached, without macros.
BeforeAfter.xlsx
The power of an example:
![]()
Please Login or Register to view this content.
Thanks, thats works wonderfully and I will marked [Solved], but can you elaborate on why I got the type mismatch error. Just trying to improve my understanding and not just ask for a solution. Thanks again!!
Because you can't compare an array to a single value:
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks