Computing.Net > Forums > Windows XP > Microsoft Excel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Microsoft Excel

Reply to Message Icon

Name: anandkala
Date: November 6, 2009 at 15:24:03 Pacific
OS: Windows XP
Product: Microsoft Excel 2007
Subcategory: General
Comment:

when i click a cell a3,i want to copy the cell values from a1:f1 in sheet1 to sheet2




Sponsored Link
Ads by Google

Response Number 1
Name: likelystory
Date: November 6, 2009 at 15:42:13 Pacific
Reply:

Left click and hold cell A1 and drag through cell F1 to highlight. Cick copy on the standard toolbar. Click sheet 2 at the bottom. Click Cell A1. Click paste on the standard toolbar.

Likely

I want to go like my grandfather did. Peacefully in his sleep. Not screaming at the top of my lungs like the passengers in his car.

(\__/)
(='.'=)
(")_(")


0

Response Number 2
Name: Humar
Date: November 6, 2009 at 15:45:08 Pacific
Reply:

Hi,

You would do better to post in the Office Software Forum which deals with programs such as Excel.

When re-posting can you provide more detail.

For example when you click A3 -
1. Is this A3 on sheet 1, or A3 on another sheet
2. If the cell you click is A3 are you entering a value into A3 or just clicking it.
3. When you copy the range from Sheet 1 to Sheet 2 do you want the data to remain linked, i.e., A1:F1 on Sheet 2 will be linked to A1:F1 on sheet 1, or is it just an unconnected copy (like Paste Special - Values)
4. Is clicking on Cell A3 essential - would it be OK to have a button that is clicked.
5. If the data in Cell A3 changes does this trigger the copy.

From what you have said here, I presume you are looking for a visual basic solution (i.e. a Macro), but please confirm.

An example of the data may also help.

Regards


0

Response Number 3
Name: anandkala
Date: November 8, 2009 at 13:17:44 Pacific
Reply:

Thank you for the immediate response, really appreciate it. But what I am looking for is different; maybe my question was not correct. Let me explain my requirement with example.

I have a Number of fields in Sheet 1.

Lets say I have the below three fields in Sheet 1

Name DOB Address

Each time I fill in this data and I press a submit button at the bottom of the sheet 1 (which needs to be configured) the data from sheet 1 should get transferred to another sheet having the same template of fields. This second sheet would be the master sheet.

After submitting, sheet 1 should get refreshed and the Sheet 2 should have the data.
When I enter a second set of data and press the Submit button, the second set of data should get appended below the first set of data already present in Sheet 2.

In the same way for next set of data and so on.

I know this requires Macro but I don’t know how to go about it. Give me one example for writing the macro for the field and How to configure the SUBMIT button


0

Response Number 4
Name: Humar
Date: November 11, 2009 at 07:14:19 Pacific
Reply:

Hi,

Here is some code to put in a button to do what you want (hopefully!)

The workbook has two worksheets named "Source" and "Master"

On the Source workbook cells A1 to G1 have the headings (name, Dob, address 1, address 2, city, state, Postal/ZIP code)

A new entry goes into cells A2 to G2, immediately underneath the headings.

On the Source workbook, use the Control Toolbox toolbar. (I don't have Excel 2007 on this PC, so I can't walk through the steps to find it)

Add a new Command Button to the Source worksheet.
Right click it (in Design mode) and select Properties and change the Caption to something useful such as Enter or Commit.
Right click again and select view code

Enter the following:
Note that

Private Sub CommandButton1_Click()
and
End Sub
will already be there, so don't duplicate them.
Option Explicit goes before Private Sub CommandButton1_Click()

Option Explicit
Private Sub CommandButton1_Click()
Dim intNextRow As Integer
Dim rngInput As Range

On Error GoTo ErrHnd

'set the input or source data range
Set rngInput = Worksheets("Source").Range("A2:G2")

'find next empty row
intNextRow = Worksheets("Master").Range("A1").CurrentRegion.End(xlDown).Row
'copy data to next empty row
rngInput.Copy Destination:=Worksheets("Master").Range("A1").Offset(intNextRow, 0)
'delete the input data
rngInput.ClearContents
Exit Sub

'error handler
ErrHnd:
Err.Clear
End Sub

Exit design mode

Copy the headings you used in cells A1 to G1 and copy them to the Master Worksheet cells A1 to G1

Enter data into cells A2 to G2 on the Source worksheet and click the button.
The data should now be on row 2 of the Master worksheet and row 2 on the Source worksheet should now be empty.

If you want to change the number of cells used for data input and copying, go back to the code and edit the line:

Set rngInput = Worksheets("Source").Range("A2:G2")
, so that the range of cells matches what you are using.

Regards
PS If you have further questions on Excel, including this post, please use the Office Software forum.


0
Reply to Message Icon

Related Posts

See More


Manage hyperlinks through... i keep getting error


Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Microsoft Excel

Ms Excel www.computing.net/answers/windows-xp/ms-excel/70210.html

can't run excel www.computing.net/answers/windows-xp/cant-run-excel/35354.html

XP Excel 2000 Help PLZ!! www.computing.net/answers/windows-xp/xp-excel-2000-help-plz/77442.html