ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Question about Macros in Excel (https://www.excelbanter.com/excel-programming/451311-question-about-macros-excel.html)

Munster

Question about Macros in Excel
 
Is it possible to make a macro repeat a specific amount of lines or be able to start from any cell?

The workbook I have I update on a semi-regular basis. 3 lines are updated when I update the workbook. The macro was recorded to start on a specific cell. When I went to test the macro for a 2nd update, I noticed the macro didn't work properly. When I looked at the code, I saw that the starting point was a specific cell.

The goal would be to edit the macro code to where I could either start it on any cell in the workbook or more specific to be able to use the same macro every 4 rows(the 4th row being the last blank row).

Claus Busch

Question about Macros in Excel
 
Hi,

Am Sat, 20 Feb 2016 21:04:32 -0800 (PST) schrieb Munster:

The workbook I have I update on a semi-regular basis. 3 lines are updated when I update the workbook. The macro was recorded to start on a specific cell. When I went to test the macro for a 2nd update, I noticed the macro didn't work properly. When I looked at the code, I saw that the starting point was a specific cell.

The goal would be to edit the macro code to where I could either start it on any cell in the workbook or more specific to be able to use the same macro every 4 rows(the 4th row being the last blank row).


if you always have 3 rows of data and then a blank row your next start
cell is:

Dim cStart As Range

Set cStart = Cells(Rows.Count, 1).End(xlUp)(3)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


All times are GMT +1. The time now is 10:30 AM.

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