How to use VBA code to reference cell to another sheet

< Back to Search results

 Category: [Excel]  Demo Available 

How to user VBA code to reference cell to another sheet




Public Sub Counter() 
Dim Col As Long
Dim Row As Long

With ActiveSheet.Shapes(Application.Caller)
Row = 5
Col = 6
End With

With Cells(Row, Col)
.Value = .Value + 1
End With
End Sub

The code you see above is to count macro button counts; it displays the result in Row 5 and Col 6 as F5. The user is trying to display it in another page (Sheet2), but couldn't refer it to the another sheet anyhow. How can this be done? All the user wants is displayed in Sheet2 and Cell F5.






With Sheet2.Cells(Row, Col)


Obtained from the OzGrid Help Forum.

Solution provided by sktneer.


See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets


See also:

How to use cell content as input to a structured reference as part of a lookup function
How to reference cells without the sheet name
How to reference a directory that is up one level from the ActiveWorkbook.Path
How to reference text in cell to unhide worksheet


Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


stars (0 Reviews)