[VBA] Best Approach To Isolating Specific Rows In A Database

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have two worksheets. The first worksheet (ws_cd) has columns of data that need to be populated from data in the second worksheet (ws_pebf1). To do this, my application must first determine which row in the second worksheet to extract the data from if it exists. This row will be based on matched data ...

ws_cd date (bdate) = ws_pebf1 date (pdate)
AND
ws_cd permit number (bpnum) = ws_pebf1 permit number (ppnum)
AND
ws_cd resource (bres) = ws_pebf1 resource (pres)
AND
ws_cd start time (bstart) = ws_pebf1 start time (pstart)
AND
ws_cd end time (bend) = ws_pebf1 end time (pend)

I am looking at the best VBA approach to isolating the row from the data in ws_pebf and transferring data from that row to it's corresponding row in ws_cd. I'm not sure if filtering is the way (and if so how), or creating strings in each workbook and matching them. There will only ever be one matching row (if any at all).

Thoughts?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of both sheets. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0
Hi Mumps, sorry for my delay in acknowledging your support. Thank you for offeringto assist.
I managed to figure out a solution (using a series of if/thens), it wasn't the neatest one, but it got the job done. I think an advanced filter applied to the second worksheet would have been all I needed. Once the single row was filtered, I could get the row number and just get the information to the first worksheet by referncing the cells of the filtered row I needed. But despite my Google searches (perhaps poor search terms), I wasn't able to find anything comprehensive to do put an advanced filter into VBA.

My project is quite large, requiring access to different network drives containing sensitive data, so unless I spent a lot of time desensitizing the large workbook code and it's data, it would have only proven frustrating to anyone kind enough to offer to help.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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