Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8200911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:37:00+00:00 2026-06-07T06:37:00+00:00

I found a thread that applied directly to the code that I’m trying to

  • 0

I found a thread that applied directly to the code that I’m trying to build here Excel VBA: Loop through cells and copy values to another workbook.

Sub test()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim CurCell_1 As Range, CurCell_2 As Range
Dim Ran As Range
Dim Group As Range, Mat As Range

Application.ScreenUpdating = True

Set ws1 = ActiveWorkbook.Sheets("Scrap")
Set ws2 = ActiveWorkbook.Sheets("FC Detail")

For Each Mat In ws1.Range("E:E")
    Set CurCell_2 = ws2.Range("F8")
    For Each Group In ws1.Range("E:E")
        Set CurCell_1 = ws1.Cells(Group.Row, Mat.Column)
        If Not IsEmpty(CurCell_2) Then
            CurCell_2.Value = CurCell_1.Value
        End If
    Next
Next

End Sub

This code works with one exception, it loops continually.

I thought that If Not IsEmpty would be the descriptor to VBA that once it reaches the end of the list to cease the program.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:37:01+00:00Added an answer on June 7, 2026 at 6:37 am

    Further to my comment, try this. This will be much faster

    Sub Test()
        Dim ws1 As Worksheet, ws2 As Worksheet
        Dim CurCell_1 As Range, CurCell_2 As Range
        Dim Group As Range, Mat As Range, Ran As Range
        Dim lRow As Long
    
        Set ws1 = ActiveWorkbook.Sheets("Scrap")
        Set ws2 = ActiveWorkbook.Sheets("FC Detail")
    
        With ws1
            lRow = .Range("E" & .Rows.Count).End(xlUp).Row
    
            Set Ran = .Range("E1:E" & lRow)
    
            For Each Mat In Ran
                Set CurCell_2 = ws2.Range("F8")
                For Each Group In Ran
                    Set CurCell_1 = .Cells(Group.Row, Mat.Column)
                    If Not IsEmpty(CurCell_2) Then
                        CurCell_2.Value = CurCell_1.Value
                    End If
                Next
            Next
        End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
Here: http://download.oracle.com/docs/html/A95907_01/diff_uni.htm#1077398 I found that on Windows Oracle is thread based, while on Unix
I've searched for similar questions to mine here, but haven't found a thread that
Alright, relevant information can be found in this thread(Is that what they're called here?).
I found that each thread still has its own registers. Also has its own
I'm trying to select an select element by name I found this thread showing
I was reading through this thread: Hidden Features of JavaScript? and found this post:
So I found this thread that was extremely helpful in traversing an array diagonally.
I found a thread on MSDN that shows how to add an item to
actually i have found some thread that asking question like mine. but every solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.