热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

货币转换器通过组合框应用于范围-Currencyconverterappliedtorangeviacombobox

Isthereawaytoapplyvbacodetoconvertthecurrencyofarangeofcellswithoutchangingthefo

Is there a way to apply vba code to convert the currency of a range of cells without changing the formula within the cell based upon the type of currency chosen in a drop-down box.

有没有办法应用vba代码转换一系列单元格的货币,而不根据下拉框中选择的货币类型更改单元格内的公式。

So for instance:

例如:

1.) drop-down box(Hong Kong, London, Berlin)

1.)下拉框(香港,伦敦,柏林)

2.) You choose (Hong Kong)

2.)你选择(香港)

3.) sheet1.range("A5:A7") and sheet1.range("G5:G7") and sheet10.range("B5:B6") all change to the currency of the chosen location (i.e. HKD)

3.)sheet1.range(“A5:A7”)和sheet1.range(“G5:G7”)和sheet10.range(“B5:B6”)都变为所选位置的货币(即HKD)

4.) You choose (Berlin) and all of the cells then adjust to Euros.

4.)您选择(柏林),然后所有单元格调整为欧元。

Is this type of vba even possible? How should I go about trying to code it.

这种类型的vba甚至可能吗?我应该怎么去尝试编码呢。

Thank you.

1 个解决方案

#1


0  

1- Use data validation to create drop down lists in your code

1-使用数据验证在代码中创建下拉列表

2- Use the following event handler to check if the value of a cell has changed

2-使用以下事件处理程序检查单元格的值是否已更改

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = Range("A1").Address Then
        'your code
    End If 
End Sub

where A1 is the cell with the drop down list

其中A1是具有下拉列表的单元格

3- Use the macro recorder to figure out what code to add to apply to format change.

3-使用宏录制器确定要添加的代码以应用于格式更改。


推荐阅读
author-avatar
ah_落落_181
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有