Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
THT THT is offline
external usenet poster
 
Posts: 7
Default Macro to only change specific cells

Hi,

This is a follow up question to a previous question I had around macros.
Not sure if I should use a macro or a function in this case.

I have File 1 (master file) with a total of 1000 rows, and File 2 (which
contains 20 of the 1000 rows) -- identical columns

For example:

File 1

Name ID
A 1
B 2
C 3
D 4
E 5

File 2
Name ID Changed (extra column)
A 1 No
C 6 Yes
D 4 No

How can I create a macro/function to only change the ID cell for "C"? I
have inserted a "changed" column in File 2 to help me identify those that
have changed.

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Macro to only change specific cells

Hi

not sure if this is the best way to approach this, but one option would be
(ensure both files are open)
in File 1 column C use the formula
=IF(ISNA(VLOOKUP(A2,[File2]Sheet2!$A$2:$B$20,2,0)),B2,VLOOKUP(A2,[File2]Sheet2!$A$2:$B$20,2,0))
and copy the formula down (move your cursor over the bottom right hand
corner of the cell, when you see a +, double click) all of column C in File
1 - this will put the value in from File 2 if there is one, or it will put
the value in from column B if the value isn't found in File 2.

Once you've checked the results in column C, you can copy them and then edit
/paste special - values back over column B if you so wish.

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"THT" wrote in message
...
Hi,

This is a follow up question to a previous question I had around macros.
Not sure if I should use a macro or a function in this case.

I have File 1 (master file) with a total of 1000 rows, and File 2 (which
contains 20 of the 1000 rows) -- identical columns

For example:

File 1

Name ID
A 1
B 2
C 3
D 4
E 5

File 2
Name ID Changed (extra column)
A 1 No
C 6 Yes
D 4 No

How can I create a macro/function to only change the ID cell for "C"? I
have inserted a "changed" column in File 2 to help me identify those that
have changed.

Thanks!



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
Change a specific code to generic in VB macro Sue Excel Discussion (Misc queries) 2 April 23rd 08 06:56 PM
how to change the value of some cells, if one specific cell value isthere. Softarcade Excel Discussion (Misc queries) 0 February 26th 08 04:49 AM
Email Macro specific Cells? neilcarden Excel Worksheet Functions 1 June 12th 07 07:31 PM
Run Macro from specific cells Piers 2k Excel Programming 3 April 4th 05 01:08 PM
getting a macro to run when a change is made to a specific row sparky3883[_4_] Excel Programming 4 April 13th 04 11:11 PM


All times are GMT +1. The time now is 04:32 PM.

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"