#1 How to best learn VBA? #2 Division problem question

  • Thread starter Thread starter Hrundi V. Bakshi
  • Start date Start date
H

Hrundi V. Bakshi

I'm continually frustrated in trying to learn VBA to do some things
which I think would be useful tools (well, for myself anyway).

I'm not bright, but MS Office is certainly not new to me.
I do want to learn VBA, more than anything, at this point, instead of
relying on your peoples' wonderful help. And I do mean wonderful, as
I've gotten lots of good answers here, but I hate being bothersome.

But, I cannot for the life of me figure out the code to do a simple
division program, as follows.


Row A contains the values 1 to 100 (each number in its own cell).

In the code, I want each of the Row A numbers to be tested if:

If the number from Row A = or ends in 0, 2, 5 Then go to the next
number in sequence.

If the number does not end in 0, 2, or 5. , but is > 2
Then divide it by 3.

If the answer leaves a remainder, then put that answer in Row C,
starting from the left-most column. Then, on to the next number in
Row A, and test, and divide and so on to 100.

I've long wished I had some of you folks ability to whip up these
programs on the fly.

Please help
 
Hi, I appreciate everyone trying to help.

If left to me to program, it simply won't happen..
So could someone please point me to a prime number calculator written
for Excel VBA ? That's all I'm looking for (at this time).

Thanks,
Hrundi
 
Had to build a couple back in school, how large of a number are you needing?

Hi. I found one on the Microsoft site, after extensive searching
around.

It starts with two dialogue boxes for first integer and final integer.
It's MUCH more simpler than the concoction I had in mind.

BUT I still have a question.

I generates the primes, and goes down column A as it posts each prime
found. But, I'd like the page to scroll down, along with each new
prime that is entered.

I found this command, but cant get it to work:

ScrollActionLineDown(0,1)

Please advise.

Thanks, once again
 
Sub ABCD()
Range("A1").Select
For i = 1 To 50
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = i
'Application.Wait Now() + TimeValue("00:00:01")
Next
End Sub


Uncomment the application.Wait if you want it to SLOW DOWN.

didn't see any division problem question.
 
...I'd like the page to scroll down, along with each new Prime.

Are you referring to this kb article?
http://support.microsoft.com/kb/202782/en-us


This is not the best, but something quick n dirty:

Change:
ActiveCell.Offset(Count, 0).Value = y

To:
If Count > 10 Then _
Application.Goto Cells(Count - 10, 1), True
Cells(Count, 1).Value = y


and change to this at the beginning:
Count = 1

Again, this is not the best, but it may give you some ideas.
 
Back
Top