Copying Row based on text in a Cell

Bob Folks

Board Regular
Joined
Jun 25, 2015
Messages
65
Hi

I am new to this Forum but look forward to many productive hours here.

I was hoping someone could help me I recuire a Macro to look at data from a Data Dump and cut the whole row and paste it onto a new sheet when the cell of that row in column "K" = [TBS]. I sure this can be done but I just cant work it out.

Any Assistance would be greatfullt apretiated.

Cheers

Bob
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,703
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Hi Bob and welcome to the forum
Is this text [TBS] the only text in the cell
AND
does it have the square brackets around it or was that just to highlight the text ??
Also, what is the name of the source sheet AND the destination sheet
 

Bob Folks

Board Regular
Joined
Jun 25, 2015
Messages
65
Hi Micheal

Thanks for your responce. There is other text in the Column but in the actual cell there either [TBS] or some other item but when it says [TBS] thats all it says, and yes it has square brackets. The source sheet is called Rpt_Heat_Summary_Standard.xls which is a data dump from a data base we use and I wish to import the data into a Tab on a workbook called zzData that I call TBS. I run this report every morning and will be blanking out the TBS sheet at the start of the process every day so as I get the most upto date values.

Once again Thanks in advance
Bob
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,703
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
So, your not just moving the data from 1 sheet to the other in the same workbook......it's to a completely separate workbook ??
If that is the case what is the sheet tab in this workbook...Rpt_Heat_Summary_Standard.xls ?
 

kvsrinivasamurthy

Well-known Member
Joined
Nov 6, 2013
Messages
657

ADVERTISEMENT

This macro copies From Sheet1 to Sheet2, Row 1 to 100
Code:
Sub CopyRows()


Dim T As Long, X As Long


With Sheets("Sheet1")
For T = 1 To 100
    If .Range("K" & T) = "[TBS]" Then
    X = X + 1
     .Range("A" & T & ":M" & T).Copy Sheets("Sheet2").Range("A" & X)
    End If
Next T
End With
End Sub
 

Drrellik

Well-known Member
Joined
Apr 29, 2013
Messages
770
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2011
  5. 2010
Platform
  1. Windows

Drrellik

Well-known Member
Joined
Apr 29, 2013
Messages
770
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2011
  5. 2010
Platform
  1. Windows

ADVERTISEMENT

well when I looked Mike had not replied, but as always as soon as I post..... I am second
LOL
 

Bob Folks

Board Regular
Joined
Jun 25, 2015
Messages
65
Hi Guys thanks for all the responces I the Rpt_Heat_Summary_Standard.xls that the Data comes from is Heat Summary. I am reading and looking at all the other responces also so thanks.

Cheers

Bob
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,703
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Can you confirm my questions in post #4 please, that are copying between workbooks AND NOT worksheets ???
 

Bob Folks

Board Regular
Joined
Jun 25, 2015
Messages
65
Hey Micheal

I have thought about this and was originaly trying to copy between Workbooks but as I need to do further work with this data down the track i have moved it to the same workbook. It just seems more logical that way and I didn't think of that till you mentioned it. Sorry for the Run Around, I am now attempting to Copy from Heat Summary to TBS in the same work book

Cheers

Bob
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,329
Members
414,055
Latest member
mcarduner

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
Top