How about:
![]()
Sub dural() For i = 1 To 50 v = Cells(i, "T").Text If v = "" Or v = "#NUM!" Then Exit For Next Range("T1:T" & i - 1).Copy End Sub
How about:
![]()
Sub dural() For i = 1 To 50 v = Cells(i, "T").Text If v = "" Or v = "#NUM!" Then Exit For Next Range("T1:T" & i - 1).Copy End Sub
Gary's Student
I had to add a column to the copy function
so I modified the macro to:
and it worked, the first time. But after saving ans exiting it said Method 'Range of object global fail. Also what needs to be changed to run this macro from another sheet?![]()
Sub Update() For i = 1 To Rows.Count v = Cells(i, "R").Text If v = "" Or v = "#NUM!" Then Exit For Next Range("R2:S" & i - 1).Copy
Last edited by Cutter; 09-18-2012 at 11:41 AM. Reason: Added code tags
If the For loop exited immediately, then i would equal 1, and i-1 would equal 0, and:
Range("R2:S" & i - 1).Copy would fail.
Say you want the macro to run on a sheet called "Special" not the sheet you happen to have active:
![]()
Sub dural() set MYSHEET=ActiveSheet Sheets("Special").Activate For i = 1 To 50 v = Cells(i, "T").Text If v = "" Or v = "#NUM!" Then Exit For Next Range("T1:T" & i - 1).Copy MYSHEET.Activate End Sub
Hi Lacaycer
Please wrap your code in Code Tags.
Have you considered using AutoFilter for this exercise?
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Example.xlsx
I tried entering the macro and was unable to make it work more than once. It was either returning the range global error, or pasting the column title. So I figured if you could see what I was trying to do or how it is actually applied, as well as explaining what I'm trying to achieve I might have better luck in solving this problem
Hi Lacaycer
Far as I can tell the code in the attached does this:
- Copy the names in $Q$2:$Q$49 that are not present in $F$2:$F$49
- Past names into the next empty cells in Column "F"
- Also transpose names into next empty cells in row of "Master Matrix" sheet
- But if there are no names that are different between "Q" and "F"….Do nothing.
It does not do this as yet:
- then sort both named ranges "StatusList" & "MasterList"
Are we on track with what we have?
It works, I'm sure that's no surprise to you. Thanks alot. I probably could have spent another 8 hours just trying to figure this out.
Hi Lacaycer
You're welcome.
Will you be doing the Sort Code? If not please explain how you wish each Named Range ("StatusList" & "MasterList") sorted.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks