"excel vba shift range" Code Answer's
You're definitely familiar with the best coding language VBA that developers use to develop their projects and they get all their queries like "excel vba shift range" answered properly. Developers are finding an appropriate answer about excel vba shift range related to the VBA coding language. By visiting this online portal developers get answers concerning VBA codes question like excel vba shift range. Enter your desired code related query in the search bar and get every piece of information about VBA code related question on excel vba shift range.
excel vba shift range
' Returns a shifted version of initial range (same size)
Function ShiftRange(ByVal pRange As Range, ByVal pRowOffset, ByVal pColumnOffset)
Set ShiftRange = pRange.Offset(pRowOffset, pColumnOffset)
End Function
'--------------------------------------------------------------------------------
Sub TestIt()
Dim rInitialRange, rShiftedRange As Range
Dim iRowOffset, iColOffset As Long
iRowOffset = 2 ' Shifts 2 rows down
iColOffset = -1 ' Shifts 1 column left
Set rInitialRange = Range("D1:B3")
' Sets a shifted version of initial range (2 rows below, 1 column left)
Set rShiftedRange = ShiftRange(rInitialRange, iRowOffset, iColOffset)
MsgBox "Initial range: " & rInitialRange.Address(False, False) & vbCrLf _
& vbCrLf & "Row offset : " & iRowOffset _
& vbCrLf & "Column offset : " & iColOffset & vbCrLf _
& vbCrLf & "New range : " & rShiftedRange.Address(False, False)
End Sub
All those coders who are working on the VBA based application and are stuck on excel vba shift range can get a collection of related answers to their query. Programmers need to enter their query on excel vba shift range related to VBA code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about excel vba shift range for the programmers working on VBA code while coding their module. Coders are also allowed to rectify already present answers of excel vba shift range while working on the VBA language code. Developers can add up suggestions if they deem fit any other answer relating to "excel vba shift range". Visit this developer's friendly online web community, CodeProZone, and get your queries like excel vba shift range resolved professionally and stay updated to the latest VBA updates.