vba for yingying
2021/10/1 6:14:01
本文主要是介绍vba for yingying,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
Dim strNameCase As String
Dim nInputDataStartRow As Integer
Dim nOutputDataTitleRow As Integer
Dim nInputColFunc As Integer
Dim nInputColSubFunc As Integer
Dim nInputColMember As Integer
Dim nInputColValue As Integer
Dim nInputColMemberList As Integer
Dim nInputRowMemberList As Integer
Dim nOUtputdatatitlecol As Integer
Dim lastRow As Integer
Dim lastCol As Integer
Private Sub Init()
'clear sheet bb
'pass
'these will init with find keyword
strNameCase = “案件名”
nInputDataStartRow = 3
nInputColFunc = 2
nInputColSubFunc = 3
nInputColMember = 4
nInputColValue = 5
nInputColMemberList = 3
nInputRowMemberList = 2
nOutputDataTitleRow = 2
nOUtputdatatitlecol = 2
lastRow = 3
lastCol = 3
Sheets(“BB”).Range(“B2”).Value = strNameCase
'init member list
Dim coltmp As Integer
coltmp = nInputColMemberList
Do While Sheets(“Control”).Cells(nInputRowMemberList, coltmp).Value <> “”
Sheets(“BB”).Cells(nOutputDataTitleRow, lastCol).Value = Sheets(“Control”).Cells(nInputRowMemberList, coltmp).Value
lastCol = lastCol + 1
coltmp = coltmp + 1
Loop
End Sub
Function GetOutputRowCase(ByVal strcase As String) As Integer
Dim row As Integer
Dim found As Boolean
found = False
row = nOutputDataTitleRow
Do While row <= lastRow
If Sheets(“BB”).Cells(row, nOUtputdatatitlecol).Value = strcase Then
GetOutputRowCase = row
found = True
End If
row = row + 1
Loop
If Not found Then
GetOutputRowCase = -1
End If
End Function
Function GetOutputColMember(ByVal strMember As String) As Integer
Dim col As Integer
Dim found As Boolean
found = False
col = nOUtputdatatitlecol
Do While col <= lastCol
If Sheets(“BB”).Cells(nOutputDataTitleRow, col).Value = strMember Then
GetOutputColMember = col
found = True
End If
col = col + 1
Loop
If Not found Then
GetOutputColMember = -1
End If
End Function
Private Sub CommandButton1_Click()
Init
'start copy
Dim row As Integer
row = nInputDataStartRow
Dim nOutputRowCase As Integer
Dim nOutputColMember As Integer
Dim strInputCase As String
Dim strInputSubCase As String
Dim strInputMember As String
Dim dInputValue As Double
Dim strcase As String
Do While Sheets(“AA”).Cells(row, nInputColValue).Value <> “”
strInputCase = Sheets("AA").Cells(row, nInputColFunc).Value strInputSubCase = Sheets("AA").Cells(row, nInputColSubFunc).Value strInputMember = Sheets("AA").Cells(row, nInputColMember).Value dInputValue = Sheets("AA").Cells(row, nInputColValue).Value If strInputSubCase <> "" Then strcase = strInputSubCase ElseIf strInputCase <> "" Then strcase = strInputCase Else 'error End If 'Get write row nOutputRowCase = GetOutputRowCase(strcase) If nOutputRowCase = -1 Then nOutputRowCase = lastRow lastRow = lastRow + 1 Sheets("BB").Cells(nOutputRowCase, nOUtputdatatitlecol).Value = strcase End If 'Get write col nOutputColMember = GetOutputColMember(strInputMember) If nOutputColMember = -1 Then nOutputColMember = lastCol lastCol = lastCol + 1 Sheets("BB").Cells(nOutputDataTitleRow, nOutputColMember).Value = strInputMember End If 'Set Value Sheets("BB").Cells(nOutputRowCase, nOutputColMember).Value = dInputValue row = row + 1
Loop
End Sub
这篇关于vba for yingying的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-11有哪些好用的家政团队管理工具?
- 2025-01-11营销人必看的GTM五个指标
- 2025-01-11办公软件在直播电商前期筹划中的应用与推荐
- 2025-01-11提升组织效率:上级管理者如何优化跨部门任务分配
- 2025-01-11酒店精细化运营背后的协同工具支持
- 2025-01-11跨境电商选品全攻略:工具使用、市场数据与选品策略
- 2025-01-11数据驱动酒店管理:在线工具的核心价值解析
- 2025-01-11cursor试用出现:Too many free trial accounts used on this machine 的解决方法
- 2025-01-11百万架构师第十四课:源码分析:Spring 源码分析:深入分析IOC那些鲜为人知的细节|JavaGuide
- 2025-01-11不得不了解的高效AI办公工具API