Simple VBA to copy Cell data, Maybe?

reneresendez

New Member
Joined
Jun 27, 2002
Messages
43
How do I accomplish the following:

A2 = 24 (This number changes, almost always is different)
A3 = 3 (This number changes, almost always is different)
B2 = Text 1

28 rows down
B30 = Text 2
B58 = Text 3
B86 = Text 4

Based on the number in A2 + 4, and repeat the procedure 3 times based on the number in A3.

How do I copy B30, B58, B86
and place on a different sheet Text 2, Text 3 & Text 4 (A1, A2 & A3)
 

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).
What's the relevance of the numbers in A2 and A3?

Scrap, that question and get me a new pair of eyes and/or glasses.:oops:
 
Upvote 0
A2 & A3 Represent

A2 & A3 represent the following:

A2 = # of Weeks of Data (24 = 24 single weeks in rows)

A3 = # of Products with Data


I plan on using a UserForm that the user will click and enter the information, the number will then be placed in A2 & A3.

Thanks
 
Upvote 0
Rene

Something like this perhaps.
Code:
Sub Test()
Dim rng As Range
Dim X As Long
Dim Y As Long
Dim I As Long
Dim arr

    X = Range("A2") + 4
    Y = Range("A3")
    
    Set rng = Range("B2")
    For I = 1 To Y
        arr = Split(rng, " ")
        rng.Offset(I * X) = arr(0) & " " & arr(1) + I
    Next I
    
    Columns("B:B").SpecialCells(xlCellTypeConstants, 23).Copy
    Sheets("Sheet2").Range("A1").PasteSpecial Paste:=xlAll, SkipBlanks:=True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,831
Messages
6,127,138
Members
449,361
Latest member
VBquery757

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