Copy a cell value and paste into another column into 25 cells

waqar1239

New Member
Joined
Mar 26, 2017
Messages
27
Hello Team,
I am have data int two columns(A & B). And I want to see the data in column A and if it starts "#" then past in the new cloumn C frm C1:C25 and chck again the data at Column A(A26, now) if it start from "#" again paste the A26 Value t column C from C26 to C50 and same way i ave to do for A9000.Also I want in column D i want to put 1 to 25 no against each cell of Column C.

I can exlain anther way,I have two Col A & B.Every 25 clumn starts wth # in column A. I want to copy the# value cell A d paste into anoter column C and to 25 cells.
[TABLE="width: 320"]
<tbody>[TR]
[TD="width: 427, bgcolor: transparent"]
Column A
#998 (Copy this one and paste this into Column C for 25 times as mentioned below & in colum D put 1 to 25 no as mentioned below)

[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]1 CREATE POINT 735MCC1:ET0401D.PNT
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]
1 PUT POINT 735MCC1:ET0401D.PNT TYPE FLOAT[TABLE="width: 268"]
<tbody>[TR]
[TD="width: 357, bgcolor: transparent"]Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Value
Column B
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"][/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]DESC = "735MCC1 DEVICE POWER 2-2"
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]AUDITUPD = NO
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]COLLECTOR = srhs14
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]COLMETH = CONNECTED
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]ENGUNITS = V
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]EXPORT = NO
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]FFREQUNITS = SECONDS
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]FASTFREQ = 2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]HIRANGE = 30.00000000
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]INITSTATE = ON
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]LORANGE = 0.00000000
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]MXSAMUNITS = SECONDS
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]MXSAMTIME = 3600
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]NAMEINCOL = 735MCC1:ET0401D.PNT
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]NUMELEMS = 1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]READDELTA = 0.10000000
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]RSTRTSTATE = PREVIOUS
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]SFREQUNITS = SECONDS
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]SLOWFREQ = 2
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]SIZE = 4
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]TRGCHANGE = NO
Value
Value
Value
Value

Column C
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998
#998

[/TD]
[/TR]
</tbody>[/TABLE]
Column D
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25[/TD]
[/TR]
</tbody>[/TABLE]


Please help me
Cheers
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
waqar1239,

Try this....

Code:
Sub wakar1239()
Application.ScreenUpdating = False
On Error GoTo Done
For r = 1 To 10000 Step 25
If Not Left(Cells(r, 1).Text, 1) = "#" Then GoTo Done
i = r + 24
Range(Cells(r, 3), Cells(i, 3)) = Cells(r, 1)
Cells(i, 4) = 25
Set MyRange = Range(Cells(r, 4), Cells(i - 1, 4))
MyRange.Formula = "=MOD(ROW(),25)"
MyRange.Formula = MyRange.Value
Next r
Done:
Application.ScreenUpdating = True
End Sub

Hope that helps.
 
Upvote 0
Try this

Code:
Sub Copy_cell_value()
    For i = 1 To Range("A" & Rows.Count).End(xlUp).Row Step 25
        Range("C" & i).Resize(25).Value = Range("A" & i).Value
        Range("D" & i).Value = 1
        Range("D" & i & ":D" & i + 24).DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, Step:=1, Trend:=False
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,279
Members
452,630
Latest member
OdubiYouth

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