任何人都可以提供以下的VBA代码
Shutter inside drawer 2'9"x2' 5.5 Niche 5'4"x1'2" 6.218 Door 6'1"x2'6" 15.207
答案 0 :(得分:0)
以下是以英尺和英寸读取值并返回该区域的vba代码。它是在假设每个项目的长度和宽度(以英尺和英寸为单位)在不同的单元格中提供的情况下编写的。如果输入采用不同的格式,则可以对其进行优化。希望这会有所帮助。
Sub sCalcArea()
Shutter_inside_drawer_1_feet = Cells(2, 1)
Shutter_inside_drawer_1_inch = Cells(2, 2)
Shutter_inside_drawer_2_feet = Cells(2, 3)
Shutter_inside_drawer_2_inch = Cells(2, 4)
Shutter_Inside_Drawer_Area = (Shutter_inside_drawer_1_feet + Shutter_inside_drawer_1_inch / 12) * (Shutter_inside_drawer_2_feet + Shutter_inside_drawer_2_inch / 12)
Cells(2, 5) = Shutter_Inside_Drawer_Area
Niche_1_feet = Cells(3, 1)
Niche_1_inch = Cells(3, 2)
Niche_2_feet = Cells(3, 3)
Niche_2_inch = Cells(3, 4)
Niche_Area = (Niche_1_feet + Niche_1_inch / 12) * (Niche_2_feet + Niche_2_inch / 12)
Cells(3, 5) = Niche_Area
Door_1_feet = Cells(4, 1)
Door_1_inch = Cells(4, 2)
Door_2_feet = Cells(4, 3)
Door_2_inch = Cells(4, 4)
Door_Area = (Door_1_feet + Door_1_inch / 12) * (Door_2_feet + Door_2_inch / 12)
Cells(4, 5) = Door_Area
End Sub