Activecell and integers

L

LongBeachGuy

I am trying to use the BallNumber instead of NumColumns in

Destination:=Worksheets("sheet1").Cells(NumRows, NumColumns)

I want to use this statement

Destination:=Worksheets("sheet1").Cells(NumRows, BallNumber)

BallNumber is an integer variable. It should come from

Sheets("sheet4").Range("b2").Value while it is the activecell.

How do I attach the Sheets("sheet4").Range("b2").Value to be
represented by the integer variable BallNumber?

---------------------------------------------------------------------------------------------------------------------------------------------

Dim RowCounter As Integer
Dim ColumnCounter As Integer
Dim rw As Range
Dim Colu As Range
Dim NumRows As Integer
Dim NumColumns As Integer
Dim BallNumber As Integer
Dim NewRange As Range, Range1 As Range, Range2 As Range
Dim Game_Date(202) As Date
Dim Games(57) As Integer
Dim Game As Variant
Dim CopyRange As Range
Dim PICKLE As Variant
Range("a1").Select
Call Setting_Up_Ball_Page
Sheets("sheet4").Activate
Range("B2").Select
Set NewRange = Range("b2:g202")
RowCounter = 2
ColumnCounter = 1
NumColumns = NewRange.Columns.Count
NumRows = NewRange.Rows.Count
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range("b2").Select
For NumRows = 2 To NumRows
For NumColumns = 1 To NumColumns
MsgBox "Row number: " & NumRows & " Column number: " &
NumColumns
Set BallNumber = ActiveCells(NumRows, NumColumns).Value
MsgBox Sheets("sheet4").Range("b2").Value & " ballnumber
is: " & BallNumber
Range("b2").Select
Sheets("sheet4").Cells(NumRows, NumColumns).Copy _
Destination:=Worksheets("sheet1").Cells(NumRows, _
NumColumns)
MsgBox ActiveCell.Value
Next NumColumns
Next NumRows
 
L

LongBeachGuy

ballnumber = Sheets("sheet4").Range("b2").Value

then the ballnumber variable will hold the value in sheet4!B2 when the
assignment was made and you can replace NumColumns with BallNumber

--
regards,
Tom Ogilvy











- Show quoted text -

thank youo sir for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top