VBA copy text from different columns to another sheet

Lars98s

New Member
Joined
Mar 28, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello,

I got an excel sheet which makes summaries.
I've tried lots of different kind of codes but i cant work out how to do the following:

I got an sheet with data. Column B is filled with headers and column C is filled with options (text) regarding the headers.
I want to use column D to put "x" of "X" in. (not case sensetive).

I would like the code to copy the headers from column B en the text form column C to another sheet. But i only want the text copied to the other sheet if i put an x in column D.
My code is a bit of a mess so i wont post it.

Hope someone can help me.
(I'm not native English so if something is unclear please ask :) )

Best regards,
Lars
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
For more information on what my excel looks like an example below. The sheet contains multiple of these.

For example I want the 3 rows with the x at the end to be copied to another sheet.
I also want the header 'Algemeen' to be shown above the 3 copied rows.


Algemeen
1Geldende voorwaarden voor het werkx
1Garanties conform Woningborg
1Andere garantievoorwaarden c.q. modules van toepassing
1CAR verzekeringx
1Zijn er geluidseisen (belastingen) op de gevel van toepassing
1Geluidsniveaumetingen binnen-buiten uitvoerenx
 
Upvote 0
Welcome to the Board!

Can you provide a more robust data example and expected results?
Might you have multiple headers in column B?
What happens if you have a header in column B, but none of the entries under it have an "x" in column D? Do you want that header skipped then, or should it show a header with no records under it?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Welcome to the Board!

Can you provide a more robust data example and expected results?
Might you have multiple headers in column B?
What happens if you have a header in column B, but none of the entries under it have an "x" in column D? Do you want that header skipped then, or should it show a header with no records under it?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual post
Thanks for the reply! I found another way for doing what i wanted!
 
Upvote 0

Forum statistics

Threads
1,214,613
Messages
6,120,515
Members
448,968
Latest member
Ajax40

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