Dynamic Column lookup and value insertion

spex2004

New Member
Joined
Jun 30, 2009
Messages
6
Hello,

I have a question I'm hoping someone can give me an answer to.

I have a worksheet with column headings. What i want to do is after selecting some values in a different column and clicking a command button, it finds the column with a specified "target string" and then inserts a value in that column based on the row my initial value is in. So for example (these are all variable values), lets say there are columns A-Z. My initial values are in column X in rows 10-15. The column I'm interested in is Column B with header "Assignment". I need VB code that will look for the header "Assignment", find that column, then allow the rest of my vb code to spit values into the cells in that column offsetted with the rows that I initially selected. So if the code finds the "Assignment" header in lets say column D - values should start getting spitted out in cells(10,4) -> cells(15,4).

Another challenge is that the initial field of values that I have selected, must be selected at all times because the rest of my vb code relies upon the ActiveCell.Selection property.

Currently, If i select my initial values and run the rest of my code, it spits out values in a static column by doing a cell.offset(x,x).value command. Essentially, i want this static column output to be dynamic where it could be a column anywhere in the sheet and doesnt have to be in a specific position based on the offset.

Any help would be GREATLY appreciated.

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If anyone wants to know how this is done, or has a similar problem, ill be happy to share the code.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,964
Members
452,371
Latest member
Frana

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