VBA Excel - Reading data from another workbook
So I'm just trying to call data from a cell in another workbook but my code is just returning "#name?" when I use "cells(3,3)".
Cells(1, 1).Formula = "='\\Drcs8570168\shasad\[CR Status.xlsx]Sheet1'!cells(3,3)"
However, this does work if I write it like this
Cells(1, 1).Formula = "='\\Drcs8570168\shasad\[CR Status.xlsx]Sheet1'!c3"
Can someone tell me why? The thing is that I need to use something like cells() so that开发者_如何学Python I can run this through multiple cells and assign the values to an array. Can someone please help me out? Thanks!
Cells()
is a VBA function that doesn't make sense when used in a Formula.
To refer to a cell using row and column numbers, you'll need to use the 'R1C1' reference style as described at the bottom of this page.
精彩评论