Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Carrie
 
Posts: n/a
Default How to get a macro to do what i want?

I have designed a form in Excel and the data that is inputted i want to be
able to save in a separate worksheet. The problem i am having is that
eveytime i record the macro, it over writes the same row each time (if that
makes sense). For example if i copied every cell in the form and paste them
into the database Row 1, i then want the new piece of information inputted
into the form to go into Row 2 and then Row 3 etc.... But it keeps going
into Row 1, it wouldnt move down the rows.

Hopefully this makes sense to someone and someone can give me some advise.
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Calculate the last row

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
if iLastRow < 1 Or Range("A1")<"" Then
iLastRow = iLastRow + 1
End If

then use this in the data placement

Cells(iLastRow,"A").Value = myValue

etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carrie" wrote in message
...
I have designed a form in Excel and the data that is inputted i want to be
able to save in a separate worksheet. The problem i am having is that
eveytime i record the macro, it over writes the same row each time (if

that
makes sense). For example if i copied every cell in the form and paste

them
into the database Row 1, i then want the new piece of information inputted
into the form to go into Row 2 and then Row 3 etc.... But it keeps going
into Row 1, it wouldnt move down the rows.

Hopefully this makes sense to someone and someone can give me some advise.



  #3   Report Post  
Carrie
 
Posts: n/a
Default

Thank you for that information but i do not understand the last bit about
Data Placement. Do i need to write that within the marco? If so then is it
underneath the End If?

Also you wrote calculate the last row, do i need to write that into the macro?

Sorry about being a pain!

Carrie

"Bob Phillips" wrote:

Calculate the last row

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
if iLastRow < 1 Or Range("A1")<"" Then
iLastRow = iLastRow + 1
End If

then use this in the data placement

Cells(iLastRow,"A").Value = myValue

etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carrie" wrote in message
...
I have designed a form in Excel and the data that is inputted i want to be
able to save in a separate worksheet. The problem i am having is that
eveytime i record the macro, it over writes the same row each time (if

that
makes sense). For example if i copied every cell in the form and paste

them
into the database Row 1, i then want the new piece of information inputted
into the form to go into Row 2 and then Row 3 etc.... But it keeps going
into Row 1, it wouldnt move down the rows.

Hopefully this makes sense to someone and someone can give me some advise.




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

The first bit shows you have to calculate the next free row by identifying
the last filled row. Somewhere you mast have some code that copies the data
to a worksheet. I haven't seen the code, but maybe something like

Range("A1").Select
Selection.Formula = "ABC"

where ABC may be a variable, or another range, or just a string. I am
suggesting replacing that with

Range("A" & iLastRow).Value = "ABC"

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carrie" wrote in message
...
Thank you for that information but i do not understand the last bit about
Data Placement. Do i need to write that within the marco? If so then is

it
underneath the End If?

Also you wrote calculate the last row, do i need to write that into the

macro?

Sorry about being a pain!

Carrie

"Bob Phillips" wrote:

Calculate the last row

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
if iLastRow < 1 Or Range("A1")<"" Then
iLastRow = iLastRow + 1
End If

then use this in the data placement

Cells(iLastRow,"A").Value = myValue

etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carrie" wrote in message
...
I have designed a form in Excel and the data that is inputted i want

to be
able to save in a separate worksheet. The problem i am having is that
eveytime i record the macro, it over writes the same row each time (if

that
makes sense). For example if i copied every cell in the form and

paste
them
into the database Row 1, i then want the new piece of information

inputted
into the form to go into Row 2 and then Row 3 etc.... But it keeps

going
into Row 1, it wouldnt move down the rows.

Hopefully this makes sense to someone and someone can give me some

advise.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Help with macro formula and variable Huge project Excel Worksheet Functions 0 December 28th 04 01:27 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"