adjustment for row 47

need adjust  to include the  values from row 47 from DTA sheet

because are not show in the N_SPACES  sheet

Capt98976.PNG29076462aaaa.xlsm
ADRIANA PACCOUNTING ASSISTANTAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aikimarkCommented:
The problem lies here:
With ActiveSheet
    lngLastRow = .Range("C" & Rows.Count).End(xlUp).Row
    lngLastCol = .Cells(14, Columns.Count).End(xlToLeft).Column
End With

Open in new window


Since the data in column C only extends to row 46, you are missing the data in row 47.  You can use the Max() worksheet function with the values from columns E through lngLastCol to calculate the last row.  Or you just iterate every other column, retaining the max row value.
0
aikimarkCommented:
Max() function implementation for the posted workbook:
With ActiveSheet
    lngLastRow = WorksheetFunction.Max(.Range("C" & Rows.Count).End(xlUp).Row, _
                                       .Range("E" & Rows.Count).End(xlUp).Row, _
                                       .Range("G" & Rows.Count).End(xlUp).Row, _
                                       .Range("I" & Rows.Count).End(xlUp).Row, _
                                       .Range("K" & Rows.Count).End(xlUp).Row)
    lngLastCol = .Cells(14, Columns.Count).End(xlToLeft).Column
End With

Open in new window

0
aikimarkCommented:
Here is the iteration solution:
lngLastRow = 0
With ActiveSheet
    lngLastCol = .Cells(14, Columns.Count).End(xlToLeft).Column
    For lngCol = 3 To lngLastCol Step 2
        Set cel = .Cells(Rows.Count, lngCol).End(xlUp)
        If lngLastRow < cel.Row Then
            lngLastRow = cel.Row
        End If
    Next
End With

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

aikimarkCommented:
Note: I'm not sure why you stored the last row value in this bit of code, if you weren't going to use it before you calculated it for the ActiveSheet (see above comments)
With wsNS
    .Range("C14:ZZ" & wsNS.UsedRange.Rows.Count).Clear
    lngLastRow = .UsedRange.Rows.Count
End With

Open in new window

0
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
aikimark

Thanks fro the  fast reponse    !!

Im not an computer literacy so
i don't know how use that

if you can provide an example

what i mean is values in rows 47 should be show in N_spaces  sheet after hit the button
0
Martin LissOlder than dirtCommented:
Please change this code that you'll find in the MoveToN_Spaces sub
With ActiveSheet
    lngLastRow = .Range("C" & Rows.Count).End(xlUp).Row
    lngLastCol = .Cells(14, Columns.Count).End(xlToLeft).Column
End With

Open in new window

to
With ActiveSheet
    Dim lngRow As Long
    lngLastCol = .Cells(14, Columns.Count).End(xlToLeft).Column
    lngLastRow = .UsedRange.Rows.Count
    For lngRow = lngLastRow To 14 Step -1
        If Application.WorksheetFunction.Count(Range(.Cells(lngRow, "C"), .Cells(lngRow, lngLastCol))) > 0 Then
            lngLastRow = lngRow
            Exit For
        End If
    Next
End With

Open in new window

If this works for you then at least part of the credit should go to aikimark.
1
Martin LissOlder than dirtCommented:
If you need it, here is a workbook with the updated MoveToN_Spaces sub.
29076631.xlsm
1
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
Working  now as needed

Thanks  I really appreciate the help Best Experts

aikimark  Thanks

Martin Liss Thanks

will this make an issue with the FILL BLANK CELL  Button ??
0
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
Great JoB !!
0
Martin LissOlder than dirtCommented:
Yes! Here's an update.
29076631a.xlsm
1
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
MArtin you mean with his update the

FILL BLANK CELL  Button will be good
0
Martin LissOlder than dirtCommented:
Yes
1
ADRIANA PACCOUNTING ASSISTANTAuthor Commented:
:)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.