VBA code to populate a table depending on values in another table

Andrevictor

New Member
Joined
May 5, 2021
Messages
10
Office Version
  1. 2019
Platform
  1. Windows
Greetings to Superbrain. Please advise on the suitable VBA code. I have two tables. One (three colums) contains values TRUE / FALSE - results of status of checkboxes. Another column contains text and the third - numerical values. I want the code to go through the first table looking for TRUE value. When found, values in two adjacent cells of the same row ("Document #" and "$xxx") to be copied and placed to the uppermost empty row of the destination table. The aim is to populate the destination table only with selected (TRUE) values and leave no empty rows. Thank you in advance.
Capture.JPG
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Can you please assure me we are working with a Excel Table

A Excel Table is a range on a Excel Sheet.
And if we are working with a Table give me the exact name of both Tables and the sheet name where the Excel Table is.

Many folks say I'm working with a Table when they really mean a sheet.
 
Upvote 0
Hy. The Excel sheet is Sheet1. The tables can be named anyhow: TableFirst, Range1, Range2, etc. I simplified my real layout with this picture to get generic code.
 
Upvote 0
Hi,​
as a generic code can't be the same using ranges or using Excel tables and as 'superbrain' can't mean 'mind reader' …​
 
Upvote 0
Hy. The Excel sheet is Sheet1. The tables can be named anyhow: TableFirst, Range1, Range2, etc. I simplified my real layout with this picture to get generic code.
I asked:
give me the exact name of both Tables

Well I need you to create the Tables and enter the data in the One table so then script can move the data to the other Table. And I want a sheet name like "Master"
Sometimes when users say sheet1 does that mean Sheet(1) or sheet named "Sheet1"
 
Upvote 0
The sheet name is exactly Sheet1, and I am not going to rename it. Forget the "tables", it is a Ranges "$B$3:$D$8" and "$F$3:$G$8".
 
Upvote 0
Needs only 2 codelines with smart ranges with headers but it seems headers are missing ?​
 
Upvote 0
I take it that you understood my needs: copy lookup values and paste to the upper empty row in another place. My main aim is not to leave empty rows in the destination range. I did not work before with "smart ranges" and cannt say anything about their headers. My original worksheet does not have the headers above thedata ranges, but if you think that they are neccessary, I will create the headres. I just do not know how.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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