0

I am trying to add data from another cell on another sheet to an existing cell with text.
The cell A1 should read, "Pay Summary #" and then the code from Q9 offset by 1 or Q10.

I cannot get the last part of the formula to display the information from Q10. Here is what I have so far:

Sub Add_info() ' '

PayRequestNumber = Sheets("Billing Summary").Range("Q9").Offset(1, 0)

Sheets("1").Select
   ActiveSheet.Range("A1").Value = "'" & "Pay Summary #" & =PayRequestNumber"

End Sub

4

1 回答 1

0

[编辑]:在获得有关请求的更多信息后,试试这个代码:

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
于 2013-08-16T16:06:52.720 回答