autofill with same value of a cell for a specific number of varing rows

cirugio

Board Regular
Joined
Mar 30, 2010
Messages
130
I am trying to build some VB code which will copy the value the asof_date field (i.e. 8/22/2014) and fill in that same value for the entire column. I tried recording it, but it autofills all the rows in the entire column A in the spreadsheet when I only want it to fill the same value for the number of rows I have populated in column b or c. For instance the example below I just want it copy 8/22/2014 for the remaining 6 rows (rows vary each day). Any thoughts on how to code this. I tried rows.count but its not working. Any help is appreciated. Thanks.


column A B C
[TABLE="width: 170"]
<TBODY>[TR]
[TD="class: xl66, width: 86, bgcolor: transparent"]asof_date
[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent"](ET)
[/TD]
[TD="class: xl63, width: 76, bgcolor: transparent"]Balance
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"]08/22/2014
[/TD]
[TD="class: xl64, bgcolor: transparent"]21:00
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,287,088
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl64, bgcolor: transparent"]21:01
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,287,088
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl64, bgcolor: transparent"]21:02
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,315,820
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl64, bgcolor: transparent"]21:03
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,315,845
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl64, bgcolor: transparent"]21:04
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,315,933
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl64, bgcolor: transparent"]21:05
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,315,950
[/TD]
[/TR]
[TR]
[TD="class: xl66, bgcolor: transparent"][/TD]
[TD="class: xl64, bgcolor: transparent"]21:06
[/TD]
[TD="class: xl65, bgcolor: transparent"]15,316,050
[/TD]
[/TR]
</TBODY>[/TABLE]



results I am seeking:

[TABLE="width: 227"]
<TBODY>[TR]
[TD]asof_date</SPAN>
[/TD]
[TD](ET)</SPAN>
[/TD]
[TD]Balance</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:00</SPAN>
[/TD]
[TD]15,287,088</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:01</SPAN>
[/TD]
[TD]15,287,088</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:02</SPAN>
[/TD]
[TD]15,315,820</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:03</SPAN>
[/TD]
[TD]15,315,845</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:04</SPAN>
[/TD]
[TD]15,315,933</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:05</SPAN>
[/TD]
[TD]15,315,950</SPAN>
[/TD]
[/TR]
[TR]
[TD]08/22/2014</SPAN>
[/TD]
[TD]21:06</SPAN>
[/TD]
[TD]15,316,050</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Code:
Range("A2:A" & Cells(Rows.Count, "B").End(xlUp).Row).value = Range("A2").value

Assuming your table is in A1 and there is no data after "21:06: in column B.
 
Upvote 0

Forum statistics

Threads
1,223,566
Messages
6,173,103
Members
452,501
Latest member
musallam

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