![]() |
Integrating data into VB code
I need a bit of help, obviously. I want to retrieve a data value from a cell
which is the NAME of a worksheet. I want to integrate that retrieved value into the VB code to either HIDE or UNHIDE the sheet. I have this: Dim code As Integer code = Worksheets("HOME").Range("C4").Value '(which equals 160628)' I want to take that value of 160628 and get it into this type of code replacing the "HOME" section: Sheets("HOME").Visible = True Thanks. |
Integrating data into VB code
A couple of things... Change your int to Long... That number is too large...
then Dim code As Long code = Worksheets("HOME").Range("C4").Value Sheets(Format(code, "0")).Visible = True -- HTH... Jim Thomlinson "Mark Warner" wrote: I need a bit of help, obviously. I want to retrieve a data value from a cell which is the NAME of a worksheet. I want to integrate that retrieved value into the VB code to either HIDE or UNHIDE the sheet. I have this: Dim code As Integer code = Worksheets("HOME").Range("C4").Value '(which equals 160628)' I want to take that value of 160628 and get it into this type of code replacing the "HOME" section: Sheets("HOME").Visible = True Thanks. |
Integrating data into VB code
Oh perfect!! Thanks...
Now to make it more fun...what if instead of 1 value in one cell, I have several values in several cells and I want to do the same thing...i.e. bring the value into the code and unhide several sheets..like 10 of them? "Mark Warner" wrote: I need a bit of help, obviously. I want to retrieve a data value from a cell which is the NAME of a worksheet. I want to integrate that retrieved value into the VB code to either HIDE or UNHIDE the sheet. I have this: Dim code As Integer code = Worksheets("HOME").Range("C4").Value '(which equals 160628)' I want to take that value of 160628 and get it into this type of code replacing the "HOME" section: Sheets("HOME").Visible = True Thanks. |
All times are GMT +1. The time now is 01:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com