For any Excel gurus out there
-
theterminator93
- Senior Member

- Posts: 770
- Joined: Fri Oct 11, 2013 7:45 pm
- Location: Avon Lake, Ohio, United States
For any Excel gurus out there
So I set up a spreadsheet to generate a script that will create a folder structure for a task at work with appropriate permissions etc. There are two sheets; sheet one has a couple rows with the names of the users, then a formula generates the username of the user. Sheet two generates the script that creates the folders and sets NTFS permissions - a three line per user process.
The problem I ran into is that since I have three rows of formula in sheet two, all of which reference the same row on sheet one, that when I copy the three rows and paste them down to however many rows I need for the number of users/folders I'm setting up, it increments by three and skips two user rows on sheet one.
Example sheet1:
a b c
1 first last username
2 joe smith jsmith
3 jack bauer jbauer
4 john doe jdoe
5 billy smith bsmith
Example sheet2 output:
a b c
1 mkdir "example\jsmith"
2 icacls "example\jsmith" /grant:jsmith r
3 icacls "example\jsmith" /grant:jsmith (oi)(ci)(io)m
4 mkdir "example\bsmith"
etc.
As you can see, if I copy/paste the three rows of formula from sheet 2 for my script it skips two rows on sheet 1. I got around this by adding two blank rows between each user on sheet one for now, but is there a way to get excel to auto increment the cell reference in the formula by one when copying and pasting three rows of formula?
The problem I ran into is that since I have three rows of formula in sheet two, all of which reference the same row on sheet one, that when I copy the three rows and paste them down to however many rows I need for the number of users/folders I'm setting up, it increments by three and skips two user rows on sheet one.
Example sheet1:
a b c
1 first last username
2 joe smith jsmith
3 jack bauer jbauer
4 john doe jdoe
5 billy smith bsmith
Example sheet2 output:
a b c
1 mkdir "example\jsmith"
2 icacls "example\jsmith" /grant:jsmith r
3 icacls "example\jsmith" /grant:jsmith (oi)(ci)(io)m
4 mkdir "example\bsmith"
etc.
As you can see, if I copy/paste the three rows of formula from sheet 2 for my script it skips two rows on sheet 1. I got around this by adding two blank rows between each user on sheet one for now, but is there a way to get excel to auto increment the cell reference in the formula by one when copying and pasting three rows of formula?
Daily: W520 i7-2860QM·Quadro 2000m·IPS FHD | T420 i7-2640M·NVS 4200m·IPS FHD | X220 i7-2640M | T601F T9900·NVS 140M·IPS UXGA
Wife's: T61p T9500·2010 FX570m·WUXGA | X220T i7-2640M
Others: T400·61p·61·60·43·42p|X41T·24·23·22|G41|A31p·22m|i1200|TransNote|380D|365XD|701C|755C
Wife's: T61p T9500·2010 FX570m·WUXGA | X220T i7-2640M
Others: T400·61p·61·60·43·42p|X41T·24·23·22|G41|A31p·22m|i1200|TransNote|380D|365XD|701C|755C
-
RealBlackStuff
- Admin
- Posts: 17485
- Joined: Mon Sep 18, 2006 5:17 am
- Location: Mt. Cobb, PA USA
- Contact:
Re: For any Excel gurus out there
Try and concatenate the commands with an Ampersand ( & ) between the functions (cmd1 & cmd2 & cmd3).
Lovely day for a Guinness! (The Real Black Stuff)
Check out The Boardroom for Parts, Mods and Other Services.
Check out The Boardroom for Parts, Mods and Other Services.
-
theterminator93
- Senior Member

- Posts: 770
- Joined: Fri Oct 11, 2013 7:45 pm
- Location: Avon Lake, Ohio, United States
Re: For any Excel gurus out there
Wouldn't that put them all in the same cell though? I'm not opposed to that if there's a way to get the three commands on separate lines in that cell when I export the sheet.
Daily: W520 i7-2860QM·Quadro 2000m·IPS FHD | T420 i7-2640M·NVS 4200m·IPS FHD | X220 i7-2640M | T601F T9900·NVS 140M·IPS UXGA
Wife's: T61p T9500·2010 FX570m·WUXGA | X220T i7-2640M
Others: T400·61p·61·60·43·42p|X41T·24·23·22|G41|A31p·22m|i1200|TransNote|380D|365XD|701C|755C
Wife's: T61p T9500·2010 FX570m·WUXGA | X220T i7-2640M
Others: T400·61p·61·60·43·42p|X41T·24·23·22|G41|A31p·22m|i1200|TransNote|380D|365XD|701C|755C
-
RealBlackStuff
- Admin
- Posts: 17485
- Joined: Mon Sep 18, 2006 5:17 am
- Location: Mt. Cobb, PA USA
- Contact:
Re: For any Excel gurus out there
Try this:
put the Cursor in that cell, click on Format/Format Cells, click on the Alignment tab.
Set the Alignment text fields to:
- Horizontal Left
- Vertical Top
- blank
Set Text control to:
- Wrap text
- blank
- blank
Now make the column as wide as the longest command.
put the Cursor in that cell, click on Format/Format Cells, click on the Alignment tab.
Set the Alignment text fields to:
- Horizontal Left
- Vertical Top
- blank
Set Text control to:
- Wrap text
- blank
- blank
Now make the column as wide as the longest command.
-
twistero
- Senior Member

- Posts: 851
- Joined: Sun Feb 26, 2012 2:25 am
- Location: Princeton, New Jersey
- Contact:
Re: For any Excel gurus out there
Try this formula:
This should give you the contents of Sheet1!C1 when placed in rows 1-3, Sheet1!C2 when in rows 4-6, etc.
Although I must say using Excel to generate scripts is slightly weird.
Code: Select all
INDIRECT("Sheet1!C" & (ROUNDDOWN(ROW()-1 / 3) + 1))Although I must say using Excel to generate scripts is slightly weird.
X60 tablet 6363-P3U, 3GB ram, 128GB SanDisk Extreme SSD, SXGA+ screen, Intel 6300
T61 Frankenpad in 15 inch T60 body, UXGA LED-lit AFFS LCD, T9300, 6GB RAM, NVidia NVS140m, Intel 6205, 128GB Crucial M4 SSD, 1TB HGST HDD + eBay caddy in Ultrabay
701c butterfly, 75MHz 486DX4, 40MB ram, 1GB CF card
T61 Frankenpad in 15 inch T60 body, UXGA LED-lit AFFS LCD, T9300, 6GB RAM, NVidia NVS140m, Intel 6205, 128GB Crucial M4 SSD, 1TB HGST HDD + eBay caddy in Ultrabay
701c butterfly, 75MHz 486DX4, 40MB ram, 1GB CF card
-
- Similar Topics
- Replies
- Views
- Last post
-
-
T540p no backlight (but there is picture)
by abgersaurus » Thu Jan 05, 2017 6:50 am » in ThinkPad T400/410/420 and T500/510/520 Series - 15 Replies
- 1529 Views
-
Last post by nitrocaster
Sun Feb 05, 2017 4:20 pm
-
-
-
Is there a list of thinkpad mods?
by fourthree » Wed Mar 08, 2017 3:18 pm » in Thinkpad - General HARDWARE/SOFTWARE questions - 3 Replies
- 1272 Views
-
Last post by RealBlackStuff
Wed Mar 08, 2017 5:06 pm
-
-
-
are there 86-key keyboard drivers that I need?
by xtian170174 » Fri Apr 21, 2017 1:42 pm » in ThinkPad Legacy Hardware - 5 Replies
- 679 Views
-
Last post by xtian170174
Sun Apr 23, 2017 2:20 pm
-
-
-
Is There A Maximized System Diagnostic App?
by jimwg » Thu Jun 01, 2017 3:42 am » in ThinkPad T400/410/420 and T500/510/520 Series - 3 Replies
- 363 Views
-
Last post by jimwg
Sat Jun 03, 2017 9:54 pm
-
Who is online
Users browsing this forum: thinkpadcollection and 2 guests



