LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default EXCEL VBA RANGE Question

Hi Rick,

If column G in "Prioritization Brk Out" has the value "Commercial" then I'd
like to update the sheet with that particular row with the column information
layout below.

(I hope my description is clear : /)

Here's the flow of things:

If: G1 or G2 or G3 or G4 and et cetera in "Prioritization Brk Out" has the
value "Commercial"

Then

Update the sheet I'm in ----
Range("A18:A100").Value = Sheets("Prioritization Brk
Out").Range("A1:A100").Value

Range("B18:B100").Value = Sheets("Prioritization Brk
Out").Range("C1:C100").Value

Range("C18:C100").Value = Sheets("Prioritization Brk
Out").Range("DC1:C100").Value

Range("E18:E100").Value = Sheets("Prioritization Brk
Out").Range("G1:G100").Value


"Rick Rothstein" wrote:

Which columns? My main thrust in this question is whether all the columns
are contiguous or not, but if you tell us which columns, it makes it easier
to modify the code with minimal explanation of how you might have to change
it.

--
Rick (MVP - Excel)


"mike" wrote in message
...
oh this is nice!

but is it possible to pull only certain columns? i don't need all the
columns of information but just a few columns of information - is there a
way
to do that?

"Rick Rothstein" wrote:

Give this macro a try, but first change the "Other Tab" references (there
are 2 of them) to the tab name of the sheet you want to copy your rows
to)...

Sub MoveCommercialRows()
Dim X As Long
Dim Offset As Long
Dim LastRow As Long
Dim OtherLastRow As Long
Const Text As String = "Commercial"
With Worksheets("Other Tab")
OtherLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
If OtherLastRow = 1 And .Cells(.Rows.Count, "A").Value = "" Then
OtherLastRow = 0
End If
End With
With Worksheets("Prioritization Brk Out")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For X = 2 To LastRow
If StrComp(.Cells(X, "G").Value, Text, vbTextCompare) = 0 Then
OtherLastRow = OtherLastRow + 1
.Rows(X).Copy Worksheets("Other Tab").Cells(OtherLastRow, 1)
End If
Next
End With
End Sub

--
Rick (MVP - Excel)


"mike" wrote in message
...
Hi,

In the "Priortization Brk" tab column G has the value "Commercial" -
each
cell has only 1 value but it could be either "Commercial" "TELCO"
"Retail
Sales" and et cetera.

For example:

A1: Project B1: Project Name ... G1: Department (Commercial, TELCO and
et
cetera).

So I want to pull from "Priortization Brk" paste the the rows stated
below
but only where column G = Commercial.

Thanks


Mike



"Rick Rothstein" wrote:

Where is the word "Commercial" located... in any cell within the row
or
in
the cells of a particular column? Also, is the word Commercial the
only
word
in the cell or can there be other text in the cell with it? Also, I'm
assuming when you say copy the row, you mean rows A thru D, correct?

--
Rick (MVP - Excel)


"mike" wrote in message
...
Hi,

I wrote the code below I read from a book to pull data from a tab
("Prioritization Brk Out") to update another tab w/in the same
spreadsheet.

However, I now need to have the code to look @ "Prioritization Brk
Out"
tab
and now only pull only the rows of data if that particular row has
the
value
"Commercial" in it.

I have reached the end of my VBA skills and am asking for this fine
communities help.

Mike

------------

Private Sub CommandButton1_Click()

Application.ScreenUpdating = False


Range("A7:A100").Value = Sheets("Prioritization Brk
Out").Range("G1:G100").Value

Range("B7:B100").Value = Sheets("Prioritization Brk
Out").Range("A1:A100").Value

Range("C7:C100").Value = Sheets("Prioritization Brk
Out").Range("H1:H100").Value

Range("D7:D100").Value = Sheets("Prioritization Brk
Out").Range("L1:L100").Value

Application.ScreenUpdating = True
End Sub






 
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
Worksheet Range Question - Excel 2003 jfcby[_2_] Excel Programming 5 November 21st 06 09:01 PM
Excel VBA .... Worksheet_Change(ByVal Target As Range) question Joseph Donnelly Excel Programming 2 May 17th 04 08:35 PM
Excel Named Range Question Bob Phillips[_6_] Excel Programming 0 May 14th 04 08:01 PM
Excel Named Range Question Chip Pearson Excel Programming 0 May 14th 04 06:57 PM
Range.Formula and Range question using Excel Automation [email protected] Excel Programming 0 September 19th 03 04:53 AM


All times are GMT +1. The time now is 08:59 AM.

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

About Us

"It's about Microsoft Excel"