select column, cut and paste it to new worksheet

W

Withnails

Hello

I am looking to select a column by a text word at the top of the column. I
would like the macro to find the word, select it and the data below it (until
the cells are blank) and copy this column into another column on worksheet2
of the same workbook.
The data in worksheet1 is roughly 15 columns by 20 rows (can vary), the cell
text will be items such as; End Bal. ledger, End Price, Client Name etc

I am unsure of how to find the text words and select a column in a row. The
position of the text along the row will change each time. Does anyone know
how this can be done? Thank you in advance for any info..
 
J

Jacob Skaria

Your below descriptions contradict each other. However try the below macro

Sub Macro()

Dim varFound As Variant, strSearch As String
strSearch = "texttofind"

Set varFound = Sheets("Sheet1").Cells.Find(strSearch)
If Not varFound Is Nothing Then
Columns(varFound.Column).Copy Sheets("Sheet2").Range("A1")
Columns(varFound.Column).ClearContents
End If

End Sub
If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top