View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Relative reference problem

Hi Norbert,

Am Thu, 30 Aug 2018 08:11:40 -0700 (PDT) schrieb Norbert:

How do I get the active cell to be one cell further down, after I ran the code?

E.g., the active cell is C46. I click on the command button. Now I want the active
cell to be C47 (relative reference, one a cell further down than before)


try:

Private Sub CommandButton1_Click()
Dim varData As Variant
Dim myCell As Range

Set myCell = ActiveCell
With myCell
varData = Range("AG23:AR23")
.Resize(1, UBound(varData, 2)).Value = varData
Set myCell = myCell.Offset(1)
myCell.Select
End With
End Sub


Regards
Claus B.
--
Windows10
Office 2016