![](/img/trans.png)
[英]Find cell text from one worksheet, in another sheet, then offset with vba
[英]What is the VBA code for putting cell data from one worksheet to another worksheet that includes text?
我正在嘗試將數據從另一張紙上的另一個單元格添加到帶有文本的現有單元格中。
單元格A1應該讀取“ Pay Summary#”,然后將Q9中的代碼偏移1或Q10。
我無法獲取公式的最后一部分來顯示Q10的信息。 這是我到目前為止的內容:
子Add_info()''
PayRequestNumber = Sheets("Billing Summary").Range("Q9").Offset(1, 0)
Sheets("1").Select
ActiveSheet.Range("A1").Value = "'" & "Pay Summary #" & =PayRequestNumber"
結束子
[編輯]:獲取有關請求的更多信息后,請嘗試以下代碼:
Sub Add_Sub_Page()
Dim wsTemplate As Worksheet
Dim strSheetName As String
Dim lPayRequestNumber As Long
Set wsTemplate = Sheets("Template")
lPayRequestNumber = Sheets("Billing Summary").Range("Q10").Value
strSheetName = Sheets("Invoice Summary").Range("T10").Value
If Evaluate("ISREF('" & strSheetName & "'!A1)") Then
MsgBox "Sheet '" & strSheetName & "' already exists.", , "Exiting Macro"
Exit Sub
End If
wsTemplate.Copy Before:=Sheets(8)
With ActiveSheet
.Name = strSheetName
.Range("A1").Value = "Pay Summary # " & lPayRequestNumber
End With
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.