Screen blinking - no errors - no results

montecarlo2012

Well-known Member
Joined
Jan 26, 2011
Messages
984
Office Version
  1. 2010
Platform
  1. Windows
Hi.
This is what I am trying to do
Range("B11").Formula = "=average(B1:XX1)" ' average distribution B1
Range("B27").Formula = "=average(B17:XX17)" ' average distribution B17
Range("B43").Formula = "=average(B33:XX33)" ' average distribution B33
Range("B59").Formula = "=average(B49:XX49)" ' average distribution B49
Range("B75").Formula = "=average(B65:XX65)" ' average distribution B65
Range("B91").Formula = "=average(B81:XX81)" ' average distribution B81

So as long as I use this basic writing, I got my results, but when I write a little code
then the screen is blinking tremendously and even with application.screenupdate.
Plus no result.
Please can you tell me my mistakes, thanks
this is my code:
VBA Code:
sub avg_m ()

Dim im As Long, cln As Long, XX As Long

XX = 1
  For im = 1 To 81 Step 16
For cln = 2 To Cells(2, Columns.Count).End(xlToLeft).Column
   Cells(im, "B").Formula = "=average(" & Cells(im, "B").Address & ":" & Cells(im, "XX").Address & ")"
   XX = XX + 16
  Next
Next
end sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
If you are trying to duplicate the results from the first set of code then why not:

VBA Code:
    For im = 1 To 81 Step 16
        Range("B" & im + 10).Formula = "=average(B" & im & ":XX" & im & ")" ' average distribution
    Next
 
Upvote 0
Solution
Thank you for your response, but I figure out,
See you next post. will be a little more complex than this one.
Happy holidays.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top