Loop

Amjtoo

New Member
Joined
May 9, 2020
Messages
12
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I have an excel sheet where there are data with empty rows in between.
My aim is to cut a range of data based on a cell value in column A and paste the data in a new worksheet by creating one.
Eg- if there is the word "name" in any row in col A then from that cell it will select xltoright and xldown , cut the entire data n paste in a new worksheet in the same file.
Again it will come back to the original sheet n scout through the rows to find cell with "name" and do the same operation but only paste in another new worksheet.
The data is not continuous so I can't run do until isempty loop

Kindly suggest if it's possible to achieve it by coding n if yes,how?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi and welcome to MrExcel.

So if you have 100 rows with the word "Name" do you want to create 100 new sheets?

You could put a sample with generic data of how your data is and which rows should be copied to a new sheet.
Use XL2BB tool.
I imagine your data is like this, so I suppose you want block 1 on a new sheet and block 3 on a new sheet.

Dante Amor
ABCDEF
1Head1Head2Head3Head4Head5Head6
2Namedatadatadatadatadata
3xdataBlock 1data
4ydatadata
5zdatadatadatadatadata
6
7Otherdatadatadatadatadata
8xdataBlock 2data
9ydatadata
10zdatadatadatadatadata
11
12Namedatadatadatadatadata
13xdataBlock 3data
14ydatadata
15zdatadatadatadatadata
16
17Otherdatadatadatadatadata
18xdataBlock 4data
19ydatadata
20zdatadatadatadatadata
Hoja1
 
Upvote 0
Hi and welcome to MrExcel.

So if you have 100 rows with the word "Name" do you want to create 100 new sheets?

You could put a sample with generic data of how your data is and which rows should be copied to a new sheet.
Use XL2BB tool.
I imagine your data is like this, so I suppose you want block 1 on a new sheet and block 3 on a new sheet.

Dante Amor
ABCDEF
1Head1Head2Head3Head4Head5Head6
2Namedatadatadatadatadata
3xdataBlock 1data
4ydatadata
5zdatadatadatadatadata
6
7Otherdatadatadatadatadata
8xdataBlock 2data
9ydatadata
10zdatadatadatadatadata
11
12Namedatadatadatadatadata
13xdataBlock 3data
14ydatadata
15zdatadatadatadatadata
16
17Otherdatadatadatadatadata
18xdataBlock 4data
19ydatadata
20zdatadatadatadatadata
Hoja1

Hi amor,
My data looks precisely like what you shared and also the macro can be designed to run 4 times
 
Upvote 0
Hi amor,
My data looks precisely like what you shared and also the macro can be designed to run 4 times


I want to cut block 1 paste in a new tab and again come back to the main sheet n cut block 2 n paste in another tab.. total 4 times I need to run this operation
 
Upvote 0
I want to cut block 1 paste in a new tab and again come back to the main sheet n cut block 2 n paste in another tab.. total 4 times I need to run this operation

if there is the word "name" in any row in col A then from that cell it will select xltoright and xldown
Do you no longer want to check if the word "Name" exists in column A?
 
Upvote 0
Do you no longer want to check if the word "Name" exists in column A?
I didn't get your question...
I want to implement a vba code containing if loop that will run 4 times n everytime it encounters the word Name in col A ( which will appear 4 times ) it will take the entire range (xltoright n xldown ) n cut paste in a new worksheet
 
Upvote 0
I didn't get your question...
I want to implement a vba code containing if loop that will run 4 times n everytime it encounters the word Name in col A ( which will appear 4 times ) it will take the entire range (xltoright n xldown ) n cut paste in a new worksheet


Now I don't understand what you need.
You can put an example of your data with the XL2BB tool and another example of the result that you need.
 
Upvote 0
1.png
 
Upvote 0
So my objective is to copy those 4 blocks dynamically and paste in 4 different tabs
 
Upvote 0
1589395586293.png


Are those cells, in the image above, highlighted in red, always empty?
 
Upvote 0

Forum statistics

Threads
1,215,831
Messages
6,127,142
Members
449,362
Latest member
Bracelane

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