Slightly new to VBA. How to load B cell in C column based on A cell

ctouchberry

New Member
Joined
Dec 4, 2017
Messages
40
I'm not very familiar with the VBA part of Excel, more familiar with the normal in-cell formulas. I apologize in advance for technical errors.

I'm working on organizing a bunch of data from a few sheets onto one separate sheet (same workbook).

I have "Tag Value Names" and "Tag Values", such as CFM: 50. Right now, I have both of them pulling from one source sheet, to the target sheet. But I just have them going to a random row, and I need certain Values to go certain columns (and rows, later on). The Value for CFM needs to go in the column labeled CFM.

This pairing comes from the source sheet as Name (in one cell) and Value (in another cell). For this purpose, the Name does not need to be transferred to the target sheet, only the Value.

I guess my question really goes something like this. How do you write the VBA function for; If A cell has CFM in it, put B cell in C column on different sheet. Also, how to do you case-proof the function, so that it doesn't fail on a "cfm", "CFm", "CFM" difference.

The evolution of this function would be to have the B cell (CFM actual value) be lined up with the Tag Name itself (AHU-2 in this case). Since the tag value number is associated with the CFM of Air Handler 2.

https://i.stack.imgur.com/0DBkE.png
https://i.stack.imgur.com/MUawC.png

Code:
With Sheets("08-Attribute")
    
    ' AHU 2 CFM Category
    Sheets("JCX").Range("T2").Value = .Range("I3").Value
    
    ' AHU 2 CFM Value
    Sheets("JCX").Range("U2").Value = .Range("K3").Value
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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