Spreadsheet help moving data
Closed
Tbonekiller
Posts
17
Registration date
Wednesday August 21, 2019
Status
Member
Last seen
June 6, 2024
-
Aug 22, 2019 at 02:08 PM
Blocked Profile - Aug 22, 2019 at 06:24 PM
Blocked Profile - Aug 22, 2019 at 06:24 PM
Related:
- Spreadsheet help moving data
- Tmobile data check - Guide
- How to insert picture in word without moving text - Guide
- Google spreadsheet right to left - Guide
- Spreadsheet function - Guide
- Gta 5 data download for pc - Download - Action and adventure
4 responses
If you wish to use the cell value, this method will work:
LEts say that you have a new value in the column....this will error out, because the sheet does not exist. So to fix this, we can see if it exists first, as in:
To use it, we would go:
Then we can take it one step further, to create the sheet, as in:
All together, it would be like this:
I hope this helps out, and you have learned something... Let us know what is next.
Have FUN!
sheetname = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value
ThisWorkbook.Worksheets(sheetname).Activate
LEts say that you have a new value in the column....this will error out, because the sheet does not exist. So to fix this, we can see if it exists first, as in:
Function sheetexist(whatsheet)
On Error GoTo NotExists
ThisWorkbook.Worksheets(whatsheet).Select
sheetexist = True
Exit Function
NotExists:
sheetexist = False
End Function
To use it, we would go:
sheetname = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value
doesitExist = sheetexist(sheetname)
if doesitexist then
ThisWorkbook.Worksheets(sheetname).Activate
end if
Then we can take it one step further, to create the sheet, as in:
Sub makesheet(whatsheet)
On Error GoTo ExitSub
With ThisWorkbook
.Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = whatsheet
End With
ExitSub:
End Sub
All together, it would be like this:
sheetname = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value
doesitexist = sheetexist(sheetname)
If doesitexist Then
ThisWorkbook.Worksheets(sheetname).Activate
Else
makesheet (sheetname)
End If
I hope this helps out, and you have learned something... Let us know what is next.
Have FUN!
So I'm running into a few errors. I'm using a numeric sheet name (ex.. 7.80 or 15.25) and the cell value is activating by the "code name" instead of the "tab name" so the information is going to the wrong sheet. I have over 150+ sheets and I'm organizing information on specific sizes into their own sheets named after their sizes. The formula you provided is what I found before actually and couldn't get it to work which is why I finally posted my own question. I've just now realized from all the searching that's what's happening with the information though. So I'm needing to change your formula to activate the sheets "tab name" or go back to writing 150+ macros and creating user forms for 150+ macros so that people entering the info don't mess something up..... Please help.
ac3mark I changed the last part of
sheetname = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value <<<<here to "text" and it works now
ThisWorkbook.Worksheets(sheetname).Activate
Thank you!!!!
sheetname = ThisWorkbook.Worksheets("Sheet1").Range("A1").Value <<<<here to "text" and it works now
ThisWorkbook.Worksheets(sheetname).Activate
Thank you!!!!
So, the data and tab name are different? Are you going to build a crosswalk?
I had the impression that the DATA in the cell, and NAME of the sheet was the same, because of this requirement; "Here is the code I have so far I want to replace the section that names the sheet with something that will look at cell "C11" and move to the sheet with the same name."
I guess I missed the scope?
If your sheet name is in cell "C11", change the lookup value from "A1" to "C11".
What is next?
I had the impression that the DATA in the cell, and NAME of the sheet was the same, because of this requirement; "Here is the code I have so far I want to replace the section that names the sheet with something that will look at cell "C11" and move to the sheet with the same name."
I guess I missed the scope?
If your sheet name is in cell "C11", change the lookup value from "A1" to "C11".
What is next?