×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

4 CHOICES INTO ONE CELL
2

4 CHOICES INTO ONE CELL

4 CHOICES INTO ONE CELL

(OP)
You can see that I am trying to fill a cell on another worksheet, but with this code, it always ends up blank because A145 is blank.  How do I keep this from happening?

Range("A139").Copy Destination:=Sheets(1).Cells(279, 1)
Range("A141").Copy Destination:=Sheets(1).Cells(279, 1)
Range("A143").Copy Destination:=Sheets(1).Cells(279, 1)
Range("A145").Copy Destination:=Sheets(1).Cells(279, 1)

RE: 4 CHOICES INTO ONE CELL

You are copying a null value into Cells(279, 1).  Why would you expect anything other than null?

RE: 4 CHOICES INTO ONE CELL

As your title says, you're copying 4 results to the same cell, so the last copy is the one you see.  Why would you expect otherwise?

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

RE: 4 CHOICES INTO ONE CELL

(OP)
your exactly right and I know that.  But if I say...I put a number in Cell A143 i want that number to go Sheet one Row 279 Column A.   But as you said, it will look at the last macro.  So I am trying to make a macro that will look at all four and input the highest number

RE: 4 CHOICES INTO ONE CELL

2
I'm not trying to be mean, but you're really not providing us much information in your original question with which to help you.  Nowhere in your original post did you say that you wanted to pick the highest number out of those few cells.

For starters, if this is all you want to accomplish then there's no need for a macro.  Just use the MAX() function of Excel.  The formula in Sheet 1 Row 279 Column A would be

MAX('WhateverYourSourceSheetNameIs'!A139:A145)

If you really want to do this in code, then use the line

Sheets(1).Cells(279, 1).Value = Application.WorksheetFunction.Max(Range("A139:A145"))

Having Excel cut and paste through code is rarely the most efficient way to go.

RE: 4 CHOICES INTO ONE CELL

(OP)
I agree handleman... an important notation in which I did not provide.  Sorry about that and thanks for all your help!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources