ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run macro until range ends (https://www.excelbanter.com/excel-programming/406795-run-macro-until-range-ends.html)

wagz

Run macro until range ends
 
Here is the short of the long....

I have an web app that I am trying to input data from an excel sheet. This
excel sheet also acts as a database, so it not only will give me my new info
but keeps that info for future reference.

Is there a way to have a userform as part of the macro that would ask the
user to input the row that they want to start the data import from and in
that same form ask for an end row. With hopes that the result of all of this
would be a macro that would perform its duty only in range that you have
provisioned.

The macro that will be running is going to be moving between the excel sheet
and the web app to copy and paste its data with multiple send keys being used.

I am using excel 2007 and intermediate with VBA and a novice with userforms.

Thanks for all the help in advance!
-Wagz


joel

Run macro until range ends
 
Set FirstCell = Application.InputBox( _
prompt:="Select First cell", Type:=8)
Set Lastcell = Application.InputBox( _
prompt:="Select Last cell", Type:=8)
Set MyRange = Range(FirstCell, Lastcell)
For Each cell In MyRange

'enter your code here

Next cell

"wagz" wrote:

Here is the short of the long....

I have an web app that I am trying to input data from an excel sheet. This
excel sheet also acts as a database, so it not only will give me my new info
but keeps that info for future reference.

Is there a way to have a userform as part of the macro that would ask the
user to input the row that they want to start the data import from and in
that same form ask for an end row. With hopes that the result of all of this
would be a macro that would perform its duty only in range that you have
provisioned.

The macro that will be running is going to be moving between the excel sheet
and the web app to copy and paste its data with multiple send keys being used.

I am using excel 2007 and intermediate with VBA and a novice with userforms.

Thanks for all the help in advance!
-Wagz


wagz

Run macro until range ends
 
Joel-

One of the things that I failed to mention is that the row would 10 cells of
data (6 that would actually be used. I imagine that this changes the
programming?

Sorry-
Eric

"Joel" wrote:

Set FirstCell = Application.InputBox( _
prompt:="Select First cell", Type:=8)
Set Lastcell = Application.InputBox( _
prompt:="Select Last cell", Type:=8)
Set MyRange = Range(FirstCell, Lastcell)
For Each cell In MyRange

'enter your code here

Next cell

"wagz" wrote:

Here is the short of the long....

I have an web app that I am trying to input data from an excel sheet. This
excel sheet also acts as a database, so it not only will give me my new info
but keeps that info for future reference.

Is there a way to have a userform as part of the macro that would ask the
user to input the row that they want to start the data import from and in
that same form ask for an end row. With hopes that the result of all of this
would be a macro that would perform its duty only in range that you have
provisioned.

The macro that will be running is going to be moving between the excel sheet
and the web app to copy and paste its data with multiple send keys being used.

I am using excel 2007 and intermediate with VBA and a novice with userforms.

Thanks for all the help in advance!
-Wagz


joel

Run macro until range ends
 
Try something like this


Set FirstCell = Application.InputBox( _
prompt:="Select First cell", Type:=8)
Set Lastcell = Application.InputBox( _
prompt:="Select Last cell", Type:=8)
Set MyRange = Range(FirstCell, Lastcell)

count = 0
For Each cell In MyRange

'enter your code here
count = count + 1
if count = 6 then exit for

Next cell


"wagz" wrote:

Joel-

One of the things that I failed to mention is that the row would 10 cells of
data (6 that would actually be used. I imagine that this changes the
programming?

Sorry-
Eric

"Joel" wrote:

Set FirstCell = Application.InputBox( _
prompt:="Select First cell", Type:=8)
Set Lastcell = Application.InputBox( _
prompt:="Select Last cell", Type:=8)
Set MyRange = Range(FirstCell, Lastcell)
For Each cell In MyRange

'enter your code here

Next cell

"wagz" wrote:

Here is the short of the long....

I have an web app that I am trying to input data from an excel sheet. This
excel sheet also acts as a database, so it not only will give me my new info
but keeps that info for future reference.

Is there a way to have a userform as part of the macro that would ask the
user to input the row that they want to start the data import from and in
that same form ask for an end row. With hopes that the result of all of this
would be a macro that would perform its duty only in range that you have
provisioned.

The macro that will be running is going to be moving between the excel sheet
and the web app to copy and paste its data with multiple send keys being used.

I am using excel 2007 and intermediate with VBA and a novice with userforms.

Thanks for all the help in advance!
-Wagz



All times are GMT +1. The time now is 03:46 AM.

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