Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default select cells that correspond to a value in other cells


I work with a number of spreadsheets with one column (E) with the value
B or C nothing else. The sheet is sorted alphabetically by that
column. I want to select all the cells in column G that correspond
only to those cells that have the value of B in column E, and cut and
paste the values into column F which is blank. Each spreadsheet has
different #'s of rows with the value B


--
Paulg
------------------------------------------------------------------------
Paulg's Profile: http://www.excelforum.com/member.php...o&userid=36077
View this thread: http://www.excelforum.com/showthread...hreadid=567579

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default select cells that correspond to a value in other cells

You don't need VBA for this. You can enter =IF(E1="B",G1,"") in F1 and
copy down through all rows of data, then copy & paste in place as values. If
you wanted a macro version, here is one:

Sub AAAAAA()
Dim c As Range, LastRow As Long
LastRow& = Range("E" & Rows.Count).End(xlUp).Row
Range("F1:F" & LastRow&).Select
For Each c In Selection
c.Value = CheckColE(c)
Next c
End Sub

Function CheckColE(Rng As Range) As Variant
If Rng.Offset(0, -1).Value = "B" Then
CheckColE = Rng.Offset(0, 1).Value
Else
CheckColE = vbNullString
End If
End Function

Hope this helps,

Hutch

"Paulg" wrote:


I work with a number of spreadsheets with one column (E) with the value
B or C nothing else. The sheet is sorted alphabetically by that
column. I want to select all the cells in column G that correspond
only to those cells that have the value of B in column E, and cut and
paste the values into column F which is blank. Each spreadsheet has
different #'s of rows with the value B


--
Paulg
------------------------------------------------------------------------
Paulg's Profile: http://www.excelforum.com/member.php...o&userid=36077
View this thread: http://www.excelforum.com/showthread...hreadid=567579


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
Up down arrow keys do not select cells if select locked cells unch roandrob Excel Discussion (Misc queries) 3 May 18th 09 12:48 AM
using filter to make a merged cell correspond adjacent cells komo2kay Excel Discussion (Misc queries) 0 December 11th 08 04:11 PM
sum of cells that correspond to non empty cells nada Excel Worksheet Functions 4 March 9th 08 01:04 PM
macro to select cells containing specific text and delete all cells but these JenIT Excel Programming 3 March 27th 06 10:07 PM
how do you "select locked cells" w/o "select unlocked cells"? princejohnpaulfin Excel Discussion (Misc queries) 3 July 16th 05 03:53 AM


All times are GMT +1. The time now is 01:03 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"