Solved

Explanation of VB Code in Excel spreadsheet

Posted on 2014-09-03
4
143 Views
Last Modified: 2014-09-04
Experts,

I had this code in an Excel spreadsheet to delete rows that had values < 0.  I want to use this logic again, but I am not sure  what this statement means.

It is  Cells(i + 3, j * 3 + 1)  that I need an explanation of

            If Cells(i + 3, j * 3 + 1) <> 0 And Len(Cells(i + 3, j * 3 + 1)) > 0 Then GoTo notDelete
0
Comment
Question by:morinia
  • 2
4 Comments
 
LVL 31

Assisted Solution

by:Rob Henson
Rob Henson earned 250 total points
Comment Utility
This uses the Cells function to identify the cell reference, it uses the following syntax:

Cells(Row,Column) where Row and Column are integers representing row and column numbers.

Your code has the Row and Column numbers set by variables i and j, these will have been set to a value earlier in the code.

Thanks
Rob H
0
 
LVL 45

Accepted Solution

by:
Martin Liss earned 250 total points
Comment Utility
The Cells() function is Cells(Row number, Column number)

i + 3 is a variable named "i" incremented by 3 and it is the row number
j * 3 + 1 is another variable named "j" multiplied by 3 before adding 1 and used as the column number
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now