Excel functions to move

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
drunkenmonkey
Pro Scripter
Posts: 90
Joined: Fri Jan 31, 2020 10:52 am

Excel functions to move

Post by drunkenmonkey » Thu Mar 25, 2021 4:40 pm

Hi Dorian,
I you like to know how to move from one range down in the active sheet or move column to the right.

Thank you! :D :D :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Excel functions to move

Post by Dorian (MJT support) » Thu Mar 25, 2021 4:45 pm

This blog post might help.
Yes, we have a Custom Scripting Service. Message me or go here

drunkenmonkey
Pro Scripter
Posts: 90
Joined: Fri Jan 31, 2020 10:52 am

Re: Excel functions to move

Post by drunkenmonkey » Thu Mar 25, 2021 4:59 pm

Thank you Dorian!
I don't use VBA in the workbook but the link is a good reference that I will studie later on.
Let say I loop a listbox and for every result I get I want to set a cell and go move row down 1 row.
I am able to do it for one result. The problem is to move to down 1 range.
Than you again! :D :D :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Excel functions to move

Post by Dorian (MJT support) » Thu Mar 25, 2021 5:18 pm

I see. So it's really just posting to cells? To move down, just add 1 to the row. You can do this in a loop

This would post to cells A5,B5,C5,D5,E5 on the first cycle, then A6,B6,C6,D6,E7 on the seconds, and so on. Of course just to set one cell you'd need 1 line and not 5, but this is a good example of posting to rows and columns.

So you'd just incorporate this into whatever loop you have.

Code: Select all

Let>XLRow=5
XLSetCell>xlbook,Sheet1,%XLRow%,1,this,res1
XLSetCell>xlbook,Sheet1,%XLRow%,2,that,res2
XLSetCell>xlbook,Sheet1,%XLRow%,3,them,res3
XLSetCell>xlbook,Sheet1,%XLRow%,4,him,res4
XLSetCell>xlbook,Sheet1,%XLRow%,5,her,res5
Let>XLRow=XLRow+1
Yes, we have a Custom Scripting Service. Message me or go here

drunkenmonkey
Pro Scripter
Posts: 90
Joined: Fri Jan 31, 2020 10:52 am

Re: Excel functions to move

Post by drunkenmonkey » Thu Mar 25, 2021 5:36 pm

Thank you so much!
Again you made my day.
:D :D :D

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1347
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Excel functions to move

Post by Dorian (MJT support) » Thu Mar 25, 2021 5:52 pm

Always happy to help.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts