ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VBA setting range in another sheet (https://www.excelbanter.com/excel-discussion-misc-queries/50457-vba-setting-range-another-sheet.html)

Jeff

VBA setting range in another sheet
 
I want to save the value in tab="Database" to a variable.

But I don't want to activate the sheet everytime, since this seems to slow
things down a lot.

So originally I was writing:

Sheets("Database").select
X = Range("F4").Value

But is there another way to set X=Range F4, without selecting the sheet?

Thanks

Bob Phillips

Good man!

X = Sheets("Database").Range("F4").Value

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jeff" wrote in message
...
I want to save the value in tab="Database" to a variable.

But I don't want to activate the sheet everytime, since this seems to slow
things down a lot.

So originally I was writing:

Sheets("Database").select
X = Range("F4").Value

But is there another way to set X=Range F4, without selecting the sheet?

Thanks




Dave Peterson

Dim X as Variant
x = worksheets("database").range("f4").value





Jeff wrote:

I want to save the value in tab="Database" to a variable.

But I don't want to activate the sheet everytime, since this seems to slow
things down a lot.

So originally I was writing:

Sheets("Database").select
X = Range("F4").Value

But is there another way to set X=Range F4, without selecting the sheet?

Thanks


--

Dave Peterson


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com