У меня есть следующий фрагмент кода:
Dim alpha As String
Sub CopyDataDump()
Dim rSelected As Range
Dim c As Range
Dim bCol As Boolean
Dim bRow As Boolean
Dim vbAnswer As VbMsgBoxResult
Dim text As String
Dim text2 As String
Dim text3 As String
Dim First As String
Dim Second As String
Dim third As String
Dim Fourth As String
Dim ToRange As String
Dim ToBeta As String
'Set variables
bCol = False
bRow = False
'Prompt user to select cells for formula
On Error Resume Next
Set rSelected = Application.InputBox(prompt:= _
"Select Range to Copy", _
Title:=sTitle & " Creator", Type:=8)
On Error GoTo 0
'Only run if cells were selected and cancel button was not pressed
If Not rSelected Is Nothing Then
'Create string of cell references
For Each c In rSelected.Cells
alpha = c.address(bRow, bCol)
text = c
First = Left(text, 2)
text2 = WorksheetFunction.Replace(text, 1, 2, "")
Second = Left(text2, 2)
text3 = WorksheetFunction.Replace(text2, 1, 2, "")
third = Left(text3, 2)
Fourth = Right(text3, 2)
ActiveWorkbook.ActiveSheet.Range(c.address(bRow, bCol)) = Fourth & third & Second & First
Next
End If
ToBeta = Replace(alpha, "A", "f")
Application.ScreenUpdating = False
rSelected.Copy ActiveWorkbook.Worksheets("Hex_Dump_Flash").Range(ToBeta)
End Sub
То, что я хочу сделать ... сохранить в альфе первый адрес, а не последний. Он всегда сохраняет последний адрес.
Если у меня диапазон А4: А8, я хочу, чтобы альфа сохранила А4, а не А8.
Большое спасибо!