I'm a complete newbie to VBScript, and I've had no luck after about a week of searching and trial-and-error attempts...
I am creating a quality check spreadsheet where a user submits data into a cell range. I'm trying to minimize the risk of user error, so I'm automating just about everything in the document and locking everything else. I'll try to keep my questions as organized as possible:
Page generation
Cursor movement on subsequent pages
Clearly, I'm doing something wrong (unfortunately, I was doing this on my laptop, which I'm not supposed to bring into work- I can post the code later if needed). I'd absolutely love if someone could write up fresh code (mine is a mess/broken and I'm kind of embarrassed to post it), but I'm also willing to take advice/hints/whatever I can get.
I am creating a quality check spreadsheet where a user submits data into a cell range. I'm trying to minimize the risk of user error, so I'm automating just about everything in the document and locking everything else. I'll try to keep my questions as organized as possible:
Page generation
- Linked to a button at the bottom of each page (worksheets are printed off and I'd like to keep them at 1 page length per sheet).
- Name the new sheet sequentially (Page1, Page2, etc - Sheet1, Sheet2, etc also works)
- Copy the first page into the newly generated one (formatting, equations, etc)
I've pretty much been searching around for code that looks like it would work, copying it, and tweaking it to meet my needs. Haven't had too much luck at combining the separate elements though. For example: I was able to create a copied page with a button and was able to name it using Application.InputBox code, but I couldn't automate the naming process with a MessageBox. I've tried a For loop (i=2, create the page, Next i), but that doesn't work when I don't know how many pages I will need from the start.
Cursor movement on subsequent pages
- Within a specific range of cells, move the cursor over, then over/down (I got this part just fine using the .offset code)
- Apply this to every sheet in the workbook (including newly generated sheets)
I wasn't able to get the code to work on newly generated sheets. It worked fine when I was in Sheet1 (with Sheet1 code), but when I tried applying the Worksheet_Change to the workbook using Workbook_Change, the code went seemingly ignored in new sheets.
Clearly, I'm doing something wrong (unfortunately, I was doing this on my laptop, which I'm not supposed to bring into work- I can post the code later if needed). I'd absolutely love if someone could write up fresh code (mine is a mess/broken and I'm kind of embarrassed to post it), but I'm also willing to take advice/hints/whatever I can get.