ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Defining Dynamic Ranges in Macro (https://www.excelbanter.com/excel-programming/319086-defining-dynamic-ranges-macro.html)

Prashant Garg

Defining Dynamic Ranges in Macro
 

I have a data worksheet in which I have to update record using a different
sheet (form for data entry).

I recorded a Macro where by records were copied from the form sheet , and
copied after the last record in data sheet. ( Say the last record was in row
10, so the data has to be updated in row 11)

But when the macro is recorded the number for the last row which was updated
while recording gets fixed (in this case row 11) , therefore when the macro
is rerun everytime row 11 is updated.

I require that this number should be generated after looking at data sheet
and identifying the last row record.

If anyone can help.....

Jim Rech

Defining Dynamic Ranges in Macro
 
Typically we use the equivalent of the keyboard Ctrl-Arrow to find the next
empty cell:

Range("A1").End(xlDown).Offset(1).Select

This assumes at least A1 and A2 have entries.

--
Jim Rech
Excel MVP
"Prashant Garg" <Prashant wrote in message
...
|
| I have a data worksheet in which I have to update record using a different
| sheet (form for data entry).
|
| I recorded a Macro where by records were copied from the form sheet , and
| copied after the last record in data sheet. ( Say the last record was in
row
| 10, so the data has to be updated in row 11)
|
| But when the macro is recorded the number for the last row which was
updated
| while recording gets fixed (in this case row 11) , therefore when the
macro
| is rerun everytime row 11 is updated.
|
| I require that this number should be generated after looking at data sheet
| and identifying the last row record.
|
| If anyone can help.....



Prashant Garg[_2_]

Defining Dynamic Ranges in Macro
 
Thanks Jim ,

Its Working Now.

Regards

"Jim Rech" wrote:

Typically we use the equivalent of the keyboard Ctrl-Arrow to find the next
empty cell:

Range("A1").End(xlDown).Offset(1).Select

This assumes at least A1 and A2 have entries.

--
Jim Rech
Excel MVP
"Prashant Garg" <Prashant wrote in message
...
|
| I have a data worksheet in which I have to update record using a different
| sheet (form for data entry).
|
| I recorded a Macro where by records were copied from the form sheet , and
| copied after the last record in data sheet. ( Say the last record was in
row
| 10, so the data has to be updated in row 11)
|
| But when the macro is recorded the number for the last row which was
updated
| while recording gets fixed (in this case row 11) , therefore when the
macro
| is rerun everytime row 11 is updated.
|
| I require that this number should be generated after looking at data sheet
| and identifying the last row record.
|
| If anyone can help.....





All times are GMT +1. The time now is 01:47 AM.

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