How to convert a String to a Range Object

后端 未结 6 1508
名媛妹妹
名媛妹妹 2021-01-23 22:44

Is there anyway to convert a string value to a Range object ? I\'m having a function which takes a Range object as a argument and need to pass a single string parameter to it

6条回答
  •  迷失自我
    2021-01-23 23:20

    Let's say Sheet1!A1 has the text value "Sheet1!B1" and Sheet1!B1 has the value "1234". The following code will use the range address stored as text in A1 as an input and copy the range B1 to A2:

    Sub Tester()
    
      Sheet1.Range(Range("A1")).Copy
    
      Sheet1.Range("A2").PasteSpecial xlPasteAll
    
    End Sub
    

提交回复
热议问题