I would like to add multiple Cells through the.Cells(x,y) Syntax to a Range named "ValueRange" like so:
Dim ws As Worksheet
Dim j As long
Dim Valuerange As Range
j = 6 'rowNumber 6
Set ws = ThisWorkbook.Worksheets("My Worksheet1")
Set Valuerange = ws.Range(ws.Cells(j, 3), ws.Cells(j, 5), ws.Cells(j, 7), ws.Cells(j, 9))
and I would like to Select this range through the same format later after changing j (rowNumber)
ws.Range(ws.Cells(j, 3), ws.Cells(j, 5), ws.Cells(j, 7), ws.Cells(j, 9)).Select
But I always get errors with this Syntax "Wrong Number of Arguments or invalid property assignment"
Can anyone help? Cheers
See comments of question for easy answer through using a Union-Statement instead of Range-Object
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.