Code not working

zakynthos

Board Regular
Joined
Mar 28, 2011
Messages
169
Hi,

can anyone tell me where the problem is with the code below.
Blocks of 1's, 2's are spaced over 200 rows ('1' is A1:A200 etc)

Cursor should move to find the first occurrence of a '1' in Column A in response to a '1' in first text box of my Userform, then move 2 columns to right (to C1)

Cursor should move to find the first occurrence of a '2' in Column A in response to a '2' in first text box of my Userform then move 2 columns to right (to C201)

Cursor should move to find the first occurrence of a '100' in Column A in response to a '99' in first text box of my Userform then move 2 columns to right (to C19801)



Many thanks :)


Code:
Sub TestPointer()
Dim y As Integer
Dim ptr As Integer
Dim myRow As Long:confused: ' (why does mnRow not appear in the code below?)

 y = 100
ptr = 0
'y = 1 goes a C1
'y = 2 goest to C201
'....
'y = 99 goes to C19801
'y = 100 goes to C20001
Do While ptr <= y
  Range("C" & ptr * 200 + 1).Select
  'your code to do whatever with the
  'data at that point
  ptr = ptr + 1
Loop
End Sub
 
Last edited:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,592
Messages
6,179,787
Members
452,942
Latest member
VijayNewtoExcel

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