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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
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:
 

reneresendez

New Member
Joined
Jun 27, 2002
Messages
43
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
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
 

Forum statistics

Threads
1,136,268
Messages
5,674,734
Members
419,523
Latest member
Urnovio

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
Top