ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   need to automate data into a column (https://www.excelbanter.com/excel-discussion-misc-queries/43546-need-automate-data-into-column.html)

Rick

need to automate data into a column
 
I need a way to create a macro that will populate a column with desired data,
but I need to the data to stop based upon where other columns end. Can this
be done?

Sample data provided below. I want to configure a macro to run and populate
the columns in front of the data using specific (never changing) data, but
the number of rows of data will be changing each time I use this workbook.

52605 08182005
20000 08202005
27459 08222005
36970 08242005
1181340 08222005
95700 08242005
59334 08242005
958102 08232005
12089 08272005
81026 08232005
28122 08182005
26247 08182005

Thank you,

Rick


Dave Peterson

Can you pick out a column that always has data:

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"C").end(xlup).row
.range("a1:a" & lastrow).value = "hi there!"
end with

would be one way (based on column C).

Rick wrote:

I need a way to create a macro that will populate a column with desired data,
but I need to the data to stop based upon where other columns end. Can this
be done?

Sample data provided below. I want to configure a macro to run and populate
the columns in front of the data using specific (never changing) data, but
the number of rows of data will be changing each time I use this workbook.

52605 08182005
20000 08202005
27459 08222005
36970 08242005
1181340 08222005
95700 08242005
59334 08242005
958102 08232005
12089 08272005
81026 08232005
28122 08182005
26247 08182005

Thank you,

Rick


--

Dave Peterson

Rick

Thanks Dave! I haven't run it yet, but I get the idea and it should work
perfectly. That is awesome!

"Dave Peterson" wrote:

Can you pick out a column that always has data:

dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"C").end(xlup).row
.range("a1:a" & lastrow).value = "hi there!"
end with

would be one way (based on column C).

Rick wrote:

I need a way to create a macro that will populate a column with desired data,
but I need to the data to stop based upon where other columns end. Can this
be done?

Sample data provided below. I want to configure a macro to run and populate
the columns in front of the data using specific (never changing) data, but
the number of rows of data will be changing each time I use this workbook.

52605 08182005
20000 08202005
27459 08222005
36970 08242005
1181340 08222005
95700 08242005
59334 08242005
958102 08232005
12089 08272005
81026 08232005
28122 08182005
26247 08182005

Thank you,

Rick


--

Dave Peterson



All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com