0
我需要我的用戶窗體的結果插入到一個頭,但我不知道怎麼我的代碼結合成一個最終項目:照片和下面的代碼插入結果放入標題
我需要頭OK按鈕 :格式化的頭按取決於我想要什麼表我的頭碼,在這種情況下,片稱爲金屬
。之後它說_____‘<「在金屬的總結。’ - (土壤/沉積物...等等,這取決於檢查框)
插入文本有史以來輸入什麼到窗體的文本框(無。編寫的代碼還)。
最終的結果。 =對於這個特殊的表將是頭說:「土壤中金屬的總結,100大街,美國」
所有幫助表示讚賞!
下面的代碼插入到結果A1只是臨時 私人小組Cancel_Click() Me.Hide 結束子
Private Sub OK_Click()
'--- Insert the correct matrix Wording ---
If Check_Soil.Value = -1 Then
Range("A1").Value = "Soil"
ElseIf Check_Sediment.Value = -1 Then
Range("A1").Value = "Sediment"
ElseIf Check_Ground_Water.Value = -1 Then
Range("A1").Value = "Ground Water"
ElseIf Check_Surface_Water.Value = -1 Then
Range("A1").Value = "Surface Water"
End If
Me.Hide
MsgBox "Completed", vbOKOnly
End Sub
Private Sub Check_Soil_Click()
'--- Checks if the Soil Button is Clicked ---
If Check_Soil.Value = True Then
Check_Surface_Water.Value = False
Check_Ground_Water.Value = False
Check_Sediment.Value = False
Else
Check_Soil.Enabled = True
End If
End Sub
Private Sub Check_Surface_Water_Click()
'--- Checks if the Surface Water Button is Clicked ---
If Check_Surface_Water.Value = True Then
Check_Soil.Value = False
Check_Ground_Water.Value = False
Check_Sediment.Value = False
Else
Check_Surface_Water.Enabled = True
End If
End Sub
Private Sub Check_Ground_Water_Click()
'--- Checks if the Ground Water Button is Clicked ---
If Check_Ground_Water.Value = True Then
Check_Surface_Water.Value = False
Check_Soil.Value = False
Check_Sediment.Value = False
Else
Check_Ground_Water.Enabled = True
End If
End Sub
Private Sub Check_Sediment_Click()
'--- Checks if the Sediment Button is Clicked ---
If Check_Sediment.Value = True Then
Check_Surface_Water.Value = False
Check_Soil.Value = False
Check_Ground_Water.Value = False
Else
Check_Sediment.Enabled = True
End If
End Sub
我的其他CODE:
SubSelect_Correct_Sheet()
' Select_Correct_Sheet Macro
Sheets("Metals").Select
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = "&""Arial,Bold""Summary of Metals in "
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.7)
.RightMargin = Application.InchesToPoints(0.7)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
End Sub
....謝謝!你的解決方案是完美的,比我寫的更有說服力。我要向你扔一個曲線球......如果我有多個不同名稱的圖紙,可以說sheet1,sheet2,sheet 3.是否有添加代碼的方法。 Sheet1在土壤中的總結「然後下一張是」Sheet2在土壤中的總結「......等等......我無法強調我多麼感謝你的幫助! –
這將是在' OK_Click':'headerText =「&ActiveSheet.name的概要&」in&headerText&「,」&TextBox1.value'「。然後在'Sub FormatHeader':'.LeftHeader =「&」「Arial,Bold」「」&text'。 –
你的回答是奇妙的 –