Macro fill cell based on value from another sheet - columns change

tcy0330

New Member
Joined
Jul 24, 2012
Messages
9
Hi all,

I could use a bit of help here.

I have a file with a master list of data, titled "Values." In this sheet, I have specific identifying columns - Building #, Floor # and Unit. (Columns B, C and D, respectively). This sheet contains information for all units on all floors in 5 different buildings.

I then have separate sheets for each separate building, with all the same column headings.

What I want to do is have the column for "sale price" sheets for the individual building autofill when a price is entered in to the "Values" sheet [column F is sale price].

I know I could use a VLOOKUP, but I would like a macro for this, unless someone can give me a good solution. My problem is that I (and others) will be sorting the data in the sheets based on multiple factors. For example, I may want to sort by the units in a building (i.e. price for each "A" unit) or by floors (all units on 5th floor) or, on the master sheet, an advance search by first building, then floor, etc... I'm also concerned about someone using the sheet and deleting the vlookup formula in the columns!

Is there a way to do this? Does my description make sense?

Thanks for all the help!
 
Hi Tom

I'm slightly confused by the code - the line ".Cells(ii, 6) = shvalues.Cells(j, 6)" writes the values to column 6 of the relevant worksheet, but what part of the code writes values to column 6 of the Values worksheet? (I see the findkey variable, but I can't see what writes the findkey variable to column 6). Any chance you could install Mr Excel HTML maker (see link below) and then show how the macro is altering the data (i.e. a before and after view of the worksheets)? Sorry I'm not exactly answering the question, but I want to fully understand the code first. Kind regards Mark

link:
http://www.mrexcel.com/forum/showthread.php?515787-Forum-Posting-Guidelines&p=2545970#post2545970
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi Tom

I've had a second look at this. I hope I'm answering the question you are asking...the code below (in this case pasted into sheet1 in the visual basic editor in a brand new workbook) shows a message box whenever the user enters a value anywhere in the "area" F5:H500.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F5:H500")) Is Nothing Then UpdatePrice
End Sub

Sub UpdatePrice()
x = 1
MsgBox x
End Sub

 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,683
Members
449,116
Latest member
HypnoFant

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