I do not know why this does this. But I was able to work around the problem. Please try this...
Maybe try declaring the FSO as Object. "Dim FSO" without a declaration declares the FSO as a variant. Just a...
Each block is a named range. There are 6 Key colors which are based on the information in column “Y”(Rental...
I cleaned up the code. This will place next month and year in cell A1. So today is Sep30 2018...
This was tested in a blank worksheet (no data). The macro will place next Month and Year in cell A1....
Updated the code to include the possibility of blank cells in the raw data. If a blank cell is found...
Lets try this again. You will need 3 sheets. Sheet1, Sheet 2 and Sheet3 Sheet1 your raw data Sheet2 is...
Hey Thank you so much. Apologies for not been very clear on the question. Using your example, in the output...
I programmatically generate workbooks with differing numbers of named worksheets. From time to time I programmatically add further named worksheets. I then programmatically alphabetically sort the worksheets but require a VBA generated list of the worksheets to be moved to the beginning of the workbook. The sheet is named “SheetIndex”. The sheet currently first sheet, after alphabetically sorting the worksheets, is not necessarily Sheet1, nor any other. How do I move the “SheetIndex” to the front as clearly “ActiveSheet.Move Before: = ActiveWorkbook.Sheets(1)” does not work!!
Please find solution here by clicking on the below link.
Link 1: VBA Move Worksheet Explained with Examples
Link 2: Move Method of Worksheet Object VBA
Hope it clarifies your requirement. Please do let me know, If you need any further assistance.
Thank you for your prompt response.
However I have been through the suggested link/s and the solution is not there.
The workbook/s created are actually accounting ledgers, each differing from the next. So in one workbook Sheet1 could be named “Motor Expenses” and in another be named “Electricity”, so the position of sheet1 is totally random, as is the position of every other sheet. Ideally, “Activesheet..Move BEFORE:=Sheets(Sheets.Count)” would work if it existed, but it does not!!
Hi, I have just found the solution: Private Sub MoveSheetIndexToFront() Application.ScreenUpdating = False Dim FirstSheet As String FirstSheet = Sheets(“SheetIndex”).Range(“A2”).FormulaR1C1 Sheets(“SheetIndex”).Move Before:=Sheets(FirstSheet) ActiveWorkbook.Save End Sub The sheet list is programmatically generated then I run a subsequent macro which looks up the first sheet on the list in Range(“A2”) and moves it as set down. I then move the “SheetIndex” cell in the Index to A2, thus achieving an appropriate index
Please share using the share button above.
If you found the answer is best answer for your question, Please mark as 'best answer' by clicking on the right tick mark icon at the left side of the answer.
Found the answer useful and wants to credit the user, then vote the answer (vote up).