Copy column to other sheet.

dwool40

New Member
Joined
Apr 27, 2018
Messages
46
Office Version
  1. 365
Platform
  1. Windows
I need to copy the text from sheet 1 (Inspection) to sheet 2(results) in the form of a list. So, sheet 1 F313:F337 needs to have the text copied to sheet to Sheet 2 B3:B27. However, if, for example, I only have text in sheet 1 F313, F319, F336, I only want to copy those 3 cells to sheet 2 B3:B5. Each time sheet 1 may have text in different cells in sheet 1 F313:F337. I am fairly new to Excel so I hope this makes sense.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Welcome to the Board!

Here is some VBA code that will do that:
Code:
Sub MyCopy()

    Dim mySrc As Range
    Dim myDest As Range
    Dim cell As Range
    Dim i As Long
    
    Application.ScreenUpdating = False
    
'   Set range to loop through
    Set mySrc = Sheets("Inspection").Range("F313:F337")
    
'   Designate first cell to paste results to
    Set myDest = Sheets("Results").Range("B3")
    
'   Loop through all cells in range
    For Each cell In mySrc
'       Check to see if something is in cell
        If cell <> "" Then
'           Copy to destination sheet
            myDest.Offset(i, 0) = cell
'           Increment row offset counter by 1 for next time
            i = i + 1
        End If
    Next cell
    
    Application.ScreenUpdating = True
    
End Sub
 
Last edited:
Upvote 0
Thanks Joe! Which sheet do I enter the code? Sorry, really trying to figure this out.
 
Upvote 0

Forum statistics

Threads
1,225,487
Messages
6,185,276
Members
453,285
Latest member
Wullay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top