Skip to content

Instantly share code, notes, and snippets.

@SONIC3D
Created June 10, 2014 16:45
Show Gist options
  • Save SONIC3D/4254fa1e8dea321df6fd to your computer and use it in GitHub Desktop.
Save SONIC3D/4254fa1e8dea321df6fd to your computer and use it in GitHub Desktop.
ForeverGame用 角色属性表_数值属性表从Excel工作表自动生成C++代码的宏
Sub btnGenerateCppSrc_Clicked() For i = 8 To 146 Step 1 'ActiveSheet.Cells(i, 12).Interior.Color = ColorConstants.vbWhite If ActiveSheet.Cells(i, 3).Interior.Color = ActiveSheet.Cells(5, 2).Interior.Color Then ' 跳过对灰色行的处理 ElseIf IsEmpty(ActiveSheet.Cells(i, 3)) Then ' 跳过空行 Else Dim cellString, minValueStr, maxValueStr, commentStr, finalString As String cellString = ActiveSheet.Cells(i, 3).Text minValueStr = ActiveSheet.Cells(i, 6).Text maxValueStr = ActiveSheet.Cells(i, 7).Text commentStr = ActiveSheet.Cells(i, 5).Text 'Debug.Print cellString Dim typeStr As String If ("float" = LCase(ActiveSheet.Cells(i, 11).Text)) Then typeStr = "float" Else typeStr = "int" End If finalString = "FG_ATTR_CLAMP_SYNTHESIZE(" & typeStr & ", m_" & cellString & ", " & cellString & ", " & minValueStr & ", " & maxValueStr & ");" & " // " & commentStr ActiveSheet.Cells(i, 12).Value = finalString End If Next End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment