简体   繁体   中英

Select Range of cells based on Row Number on a different sheet

I am completely lost. I am trying to use values from cells on a different sheet to establish the Starting Row and the Ending Row, in ColumnA of the Active Sheet.

I keep getting Compile Errors. Can someone help with the VBA format?

Dim s As String
s = "=Math!A3"
Range("=Math!C3", 1)("=Math!D3", 1) = s

Thanks

Using some variables:

With ActiveWorkbook.Worksheets("Math")
    Dim startRow As Long
    startRow = .Range("C3").Value

    Dim endRow As Long
    endRow = .Range("D3").Value
End With

Dim s As String
s = "=Math!A3"

ActiveSheet.Range("A" & startRow & ":A" & endRow).Formula = s

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM