Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




PivotField Selection Problems!!!


Hi all,

Can anyone help. I have this code to create a pivot table on a seperate sheet in my workbook. The problem is i want to be able to change the pivotfield ranges below by being able to correspond to a point on the worksheet i.e. activecellranger1c1 or cell A1..etc.. At the moment if iwant to change the datafield and row field it is manually done in VB Editor.

Thanks!!!

Code:
ActiveCell.FormulaR1C1 = "I want this to appear"


.PivotFields Range("I want this to appear !!!HERE!!!").Orientation = xlDataField
.PivotFields Range("I want this to appear !!!HERE").Orientation = xlRowField


Sub CreatePivotTable()
Dim PTCache As PivotCache
Dim PT As PivotTable

On Error Resume Next
Application.DisplayAlerts = False
Sheets("Summary").Delete
On Error GoTo 0

Set PTCache = ActiveWorkbook.PivotCaches.Add _
(SourceType:=xlDatabase, _
SourceData:="Source Data!R1C1:R3000C20") _

Worksheets.Add
ActiveSheet.Name = "Summary"
ActiveCell.FormulaR1C1 = "I want this to appear"


Set PT = PTCache.CreatePivotTable _
(TableDestination:=Sheets("Summary").Range("b22"), _
TableName:="PivotTable1")
ActiveWindow.Zoom = 75
ActiveWindow.DisplayGridlines = False

With PT
.PivotFields Range("I want this to appear !!!HERE!!!").Orientation = xlDataField
.PivotFields Range("I want this to appear !!!HERE").Orientation = xlRowField
.PivotFields("Function").Orientation = xlPageField
.PivotFields("Location").Orientation = xlPageField


End With


End Sub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving To The Next Item In A Pivotfield
I have some code which runs in this For loop.


Code:
For Each PivotItem In ActiveSheet.PivotTables("PivotTable1").PivotFields("Questions").PivotItems
Sheets("Pivot Table").Select
Range("A4").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Chart Data").Select
ActiveCell.Select
ActiveSheet.Paste
Sheets("Pivot Table").Select
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Chart Data").Select
ActiveCell.Offset(1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(3, 0).Select

Next

The item "Questions" is in the page field at the top.

I'd like the code to move to the next item in the page field, and perform the code.

Any idea how it's done?

PivotField Text Limit
Does anyone know if there is any way to view more than 255 characters in a pivot table field?

i have created a database in excel for users to write comments, which are then viewed/sorted via a pivot table. The problem is that some people have written entries with more than 255 characters. Excel is truncating the entries in the pivot table results, although the full text is still in the original spreadsheet.
Is there a default that I can change, or is it a limitation of the Pivot table?

Coloring Pivotfield.item
Hi guys,

I would like to prepare code which will color pivotfield.pivotitem.labelrange. So far I have prepared the following code:



VB Code:
Dim pvtfield As PivotFieldDim pvtitem As PivotItemsSet pvtfield = ActiveSheet.PivotTables("PivotTable9").PivotFields("year2_sk")For Each pvtitem In pvtfieldpvtitem.LabelRange.Interior.ColorIndex = 24Next


When I run this code it giving me back the 438 error code and highlights me the 4th line.
Can anybody tell me what is wrong?

Thanks. Boris


I have changed to this and it works:


VB Code:
Dim pvtfield As PivotFieldDim pvtitem As PivotItemDim i, jSet pvtfield = ActiveSheet.PivotTables("PivotTable9").PivotFields("year2_sk")i = pvtfield.PivotItems.CountFor j = 1 To i  pvtfield.PivotItems(j).LabelRange.Interior.ColorIndex = 24  pvtfield.PivotItems(j).LabelRange.Font.Bold = True  pvtfield.PivotItems(j).LabelRange.HorizontalAlignment = xlCenterNext j

Pivot Table; Loop Through PivotField Values
I’m new to this, but I’ll give it a shot. I’m trying to create a macro that will look at a list and iterate all of the values through a PivotField. I can get this to work if I write the specific value needed in the PivotField into the macro, but not a way to cycle through all of the values without naming them.

For example, a PivotField "NEW_USED" with 2 values "New" and "Used":

Sheets("Amort").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("NEW_USED").Current Page = _
"NEW"
ActiveSheet.PivotTables("PivotTable1").PivotFields("NEW_USED").Current Page = _
"USED"

Any help would be appreciated.

Listbox Selection Problem - Window Scrolls And Selection Is Wrong
Greetings.

I am populating a listbox on demand with vba. When the contents of the box number enough to put the bottom of the box off the screen, clicking on any selection results in a different item being sent to the target, followed by an unrequested window scroll.

Is there a way to prevent the window from scrolling until the correct selection is sent to the target cell?

Thanks!

Combobox Selection Not Showing The Selection In Access 2K Continuous Form ...
Hi all.

This one probably isn't one of my skullthumping problems ... I just setup a continuous form with a "Yes/No" combobox on it. This combobox is setup to be a value list with 2 columns Yes/No; True/False AND it is bound to a recordsource that is a logical type. When I invoke this form the Yes/No does not display in this combobox even with the underlying record having a logical value ... Any thoughts on what I'm missing?

Notes:

I have set the bound column to the 1st column (default) ...

Thanks!

- Mike

Checking Selection Length: [Len(Selection.text)] ...
WORD VBA....
Checking selection length: [Len(Selection.text)] ...

Hello all,

I'm working on some code in Word I "inherited" from a predecessor and want to fix a little bug thats bothering me.

From a toolbar, macros are used to "tag" selected text, a "check" makes sure the user has actually selected some text first. It's this "check" that isn't working as I would like...

The following is whats being used at the moment:
_____________________________

Lenth = Len(Selection.text)

If Lenth = 1 Then

"Error Message"

Else

"Cut"
"Type opening tag"
"Paste"
"Type closing tag"

End If
_____________________________


This works to an extend, if nothing is selected the error message is shown, and tags the text if more than 1 character is selected.
However - the "check" also throws out an error message if only 1 character is selected.

Can someone explain what these lines of code are actually doing and how to fix it please?

Lenth = Len(Selection.text)
If Lenth = 1 Then

I'm really not bothered what the length is, just if anything is selected or not, so any suggestions for a different approach?

Cheers once again - Simon . "a learning novice..."

Record Selection Based On Combo Selection
Hello,

I have populated a combo box with the 1st field from all my records in access db. I have textboxes bound to each field on my form. When I click on one of the combo values I want the relevant record to be shown in the text boxes. I used the following code to find the record in the db but it displays the first record regardless of the combo selection

Private Sub cboOut_Click()
adoBook.Recordset.Find "[RegNo]='" & cboOut.Text & "'"
adoBook.Refresh
End Sub

Set Markers In WMP9 - Selection Start -Selection End
How do we use Markers in MediaPlayer Series 9 to do the equivalent of Version 6.4's .SelectionStart . SelectionEnd ?

I can use Controls.CurrentPosition to read the current position, but can't set the START and END points (preferably in FRAMES, not seconds) on a Marker.

Happy to forget Markers and just use .CurrentPosition, if that's efficient.

Thanks!

Selection With Caret At Start Of Selection.
I have a log, and in the log I have made it so users can review older text, without it jumping to the bottom.

The problem is that I must reassign the Sel properties, and when I put them back, regardless of where the selstart is, after I use .SelStart and .Sellength the .Selstart goes to the end of the selection, causing selection problems.

ListView Selection Based On Second ListView Selection
I have 2 ListView controls.

ListView1 contains a number of items, for one of which a SubItem contains the number 1.

ListView2 contains 10 items, containing Subitems with numbers 1 to 10.

If I select the item in ListView1, of which the SubItem contains the number 1, I would like the ListView2 selection to change to that which contains the SubItem with the number 1 as well.

thx

Selection
Hey All -

A while back someone introduced me to a method of autofilling a column based on the contents of another column using the following VBA code:


Code:
Range("B5").AutoFill Destination:=Range("A5:A" & Range("B5").End(xlDown).Row)

I'm currently trying to alter that code to select certain cells based on the contents of another. For example, I have data in cells B7 down through B52. I want my code to SELECT C7 through D52. I actually want two columns selected and from there I have some other code I'm running.

This, however, is the only part I cannot get working. Anyone have any ideas how to alter the above code to select rather than autofill?

Thanks much!!

Selection
I am having trouble with some code I have developed and need some assisstance. What I am trying to do is look through a list of data and selecting the content between the numerical values in the list of data. I am able to do this just fine. Now I want to sort the the selection by date and add the term "remove" to any numbers greater than 0 which occurrs one year before the current date. I am able to do this for the first instance where this happens in the workbook. The macro then goes and sorts each selection afterwards but does not run the macro to add "removed" to the selection...

Any Ideas? I think that I might be jumping out of the FOR/NEXT too soon, but I don't know where to go from here.

Here is the code that I am using...


Code:
Sub Convert_Data()
Dim intV As Integer
Dim intW As Integer
Dim intX As Integer
Dim intY As Integer
Dim intR2 As Integer

'Finds the number of records available
intW = Application.WorksheetFunction.CountA(Sheets(1).Range("B:B"))
'Loops through each of the records
For intX = 1 To intW
'Tests the value of the cell to determine if it is numeric
If IsNumeric(Sheets(1).Cells(intX, 2).Value) Then
'Loops to find the next numeric number
For intY = (intX + 1) To intW
If IsNumeric(Sheets(1).Cells(intY, 2).Value) Then
'Selects the range of dates
intR2 = (intY - 1)
Range(Cells((intX + 1), 2), Cells(intR2, 6)).Select
'Sorts the dates for evaluation
Selection.Sort Key1:=Range("C" & (intX + 1)), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
intZ = intR2 - intX

'Loops through each of the dates
For intV = (intX + 1) To intZ
'Checks to see if the date is less than or equals to one year old
If Sheets(1).Cells(intV, 3).Value <= (Date - 365) Then
'Ensures the value is greater than 0 because attendance credits carry over
If Sheets(1).Cells(intV, 5).Value > 0 Then
'If the date is less than or equals to one year old, then it adds "-Removed" to the end of the occurrence
Sheets(1).Cells(intV, 5).Value = Sheets(1).Cells(intV, 5).Value & "-Removed"
End If
End If
Next intV
'Recalculates the actual occurrences
Sheets(1).Cells(intX, 13).Value = Application.WorksheetFunction.Sum(Sheets(1).Range(Cells((intX + 1), 5), Cells(intR2, 5)))
Exit For
End If
Next intY
End If
Next intX

End Sub

Thanks,
Mike

Sum A Selection
What's the best way to return the sum of the cells that you have selected in a range? I don't want the value placed in any cell. Unfortunately there is no such thing as Selection.Sum I think!

Specify The Selection
Hey, would like some help with how to specify the selection. As my code is now the function appears with every click, in any cell. I would like to specify the function to only appear when clicking in a cell with content OR maybe limit the function to one column, as it is a list of names in the document.

VB:

Sub Worksheet_SelectionChange(ByVal rTarget As Range)

Dim wb As Workbook, FileName As String

ButtClicked = 0

UserForm1.Show vbModal

Select Case ButtClicked
Case 1
FileName = rTarget.Value & "Inköp.xls"
Set wb = Workbooks.Add("c:NätverksfilerFrågeformulärInköp.xls")
wb.SaveAs ("c:NätverksfilerSparade" & FileName)
Case 2
FileName = rTarget.Value & "Logistik.xls"
Set wb = Workbooks.Add("c:NätverksfilerFrågeformulärLogistik.xls")
wb.SaveAs ("c:NätverksfilerSparade" & FileName)
Case 3
FileName = rTarget.Value & "Kvalitet.xls"
Set wb = Workbooks.Add("c:NätverksfilerFrågeformulärKvalitet.xls")
wb.SaveAs ("c:NätverksfilerSparade" & FileName)
Case 4
FileName = rTarget.Value & "Utveckling.xls"
Set wb = Workbooks.Add("c:NätverksfilerFrågeformulärUtveckling.xls")
wb.SaveAs ("c:NätverksfilerSparade" & FileName)
End Select

Set wb = Nothing

If ButtonClicked = 0 Then Exit Sub

End Sub

Selection Help Please
hi. i have the following code


Code:
Dim mission(1 To 20) As Boolean

mission(1) = False
mission(2) = False
mission(3) = False
mission(4) = False
mission(5) = False
mission(6) = False
mission(7) = False
mission(8) = False
mission(9) = False
mission(10) = False
mission(11) = False
mission(12) = False
mission(13) = False
mission(14) = False
mission(15) = False
mission(16) = False
mission(17) = False
mission(18) = False
mission(19) = False
mission(20) = False


it is a set of 20 booleans each is meant to be linked to a set of missions stored in subroutines.

what i am having a problem with ishow i can get the program to check the list as find the first false value and that mission(i) is then selected so that its corrosponding mission subroutine will be loaded.


so:

Code:
mission(1) = true
mission(2) = true
mission(3) = false

so now the program will select the mission(3) subroutine



i was wondering if i could get some help on this. at the moment i am thinking of using a if...then...elseif selection 20 times (lol) but i find this a bit tedious, is there a better way to do this?

Selection Box
I wanna make a selection box (Rubber Band Lines) that appears to move (not just the stationary dotted line) im guessing a timer control and redrawing it somehow?

Tab Selection
I've noticed that when I tab between text boxes, it doesn't automatically select text that's already there, as it would on the internet. Is it possible to make it do this?

Using SQL - Between Selection
Hello.. I have a rather simple problem

i have two fields on my table which i need to use. The first contains the short date when an activity started and the second contains the short date when the activity ends. I want to retrieve by sql statement all the activities that are currently on...

I tried to use this statemt though it wont work:

Code:
sqlstr = "Select * FROM activities WHERE #" & Date & "# BETWEEN act_start and act_end AND activity_id = " & txt_act_num

The last AND refers to the fact that i need an activity with some id that is inputed into a textbox. I'm sure that it doesn't work... checked it well.

Please help asap... thanks!

Alt+Tab Selection
I've just noticed that, if my application had a modal form open, it disappears from the Alt+Tab selection – I can switch away but can’t switch back. If there are modeless forms open then all is OK. Why is this and can it be fixed? Anyone know?

TIA

Dave

Selection
quick question

I need to select certain cells in a worksheet
can't use the Range command cause i cant specify cells since they change all the time "its a database"
I use the ActiveCell.Offset command to move around the active cell, so everytime it records data, it moves and parks the active cell in the next place, ready for the next set of data
now i want to tell it to select the three cells "below" the active cell, so i can take them and update my charts

Is there any way "command" to tell it to select the "3" cells underneath the active cell??

Selection Box
In several Windows applications when the user is required to select "components", the screen is set up as follows:

There are two boxes on the screen. One which contains a list of available "components" and one which contains a list of selected
"componets". In between the two boxes, there are selection arrows ("<", ">", "<<", ">>") which move "components" from one box to the other.

With a little bit of effort, I could produce something similar to this. Because this seems to be a fairly common "control", I was wondering if this was something that was included with VB, saving me a little bit of time.

Thanks!

Selection
I have a richtextbox. In my Richtext_Change() code I have this:
Richtext.SelStart = 0
So that the text is inputted backwards. My problem is this,
When I try to select text to make bold, it works, but the cursor is then sent back to 0, instead of the selected text remaining selected. I tried this in my Richtext_selChange() code:
Dim sLength as integer
Dim sStart as integer

sLength = Richtext.Sellength
sStart = Richtext.SelStart

and then this code at the top of the Richtext_change() module:

if (Richtext.selLength = 0) then
Richtext.SelStart = 0 'the code at the top
Else
Richtext.selStart = sStart
Richtext.selLength = sLength
End If

but is doesn't work, any ideas to keep the text selected?

TreeView Selection
I am working with a tree view, I've got it all set up, but I certain things to pop up when a user selects certain nodes. I know how to make the stuff show up, but I dont know how to make the selection of the node make it pop up.

I have tried using .selection and .key, but I may be using them wrong, please help me out

File Selection
I need a way to select the 10 most recently created files from a directory. I have a function that selects the newest file, but I now need a way to expand that to the newest ten files. I am assuming that I read them into an array but I'm having serious mind cramps with how to drop off everything but the most recent 10. The directory has anywhere from 50 to 900 files in it. Any help would be appreciated.

Thanx...

No Selection In My Listview
hi,

i've made a listview, and i want to make sure nothing is selected when the form starts up, so my fill looks like this:

With lvShowList
.View = lvwReport
.GridLines = True
.LabelWrap = True
.FullRowSelect = True

.ColumnHeaders.Add , , "Naam"

'then here i _do_ stuff , is all ok, just fill the thing up with
'the correct data

With .ListItems
For i = 0 To UBound(arrData)
.Add , , arrData(i)
Next i
End With
Set lvShowList.SelectedItem = Nothing
End With

when i debug: selected item is set to nothing,
unfortunately, it _is_ set to the first item.
anybody's got a clue on how to _really_ set selecteditem to nothing (and make it stay that way untill a user clicked on something)

thanx,
christie

Driver Selection
How can I integrate the camera driver or other driver using combo box? The driver(s) will be viewed and the user will choose what driver to use using combo box.

Drag Selection
Can someone point me in the right direction on how to select a group of objects on a form and then drag those objects to another container?
Thanks!

Image Selection
In VB6, I have a project. To open a JPG file, and select a portion of the image using magic wand like tool (in photoshop), because the image selection wont be in a proper shape. After the selection I want to store an unique information about the selection in a Table (MS Access) to retrive the info about the portion later on.

Here what's the way to select a portion using magic wand like tool using API or any OCX ?

How to get an Unique info about the selection ?

It's Not Retained Now... Selection...
I solved all of my problems, and now I want to know (it's pretty complicated) ):

Imagine you're making a game, an you need to select an object. How should I do it?

For example, I have a cube on screen, so I click on it, and the program realises that I have clicked it.

I really need help!

My previous posts maybe were a little weird, but I really need help now.

I'll give you one example:

In Warcraft, Starcraft, AoE etc. strategies, or (even better) - World of Warcraft and any kind of MMORPG.

Hope you can help me!

Picture Selection
I need to have my slot game pick a random number and depending on the number show a specific picture. I got it to work but I had to have 7 picture boxes for the first slot, 7 for the next and another 7 for the last. I would think there is a better way to do this. If so how?
Thanks in advance.

Printer Selection
How can i select a printer, and change the properties of the printer, with VBA in Word?

Selection.Find
I'm trying to figure out how to use Find in a macro in Word. I've got this

Code:
Do
Windows(strDate).Activate
Selection.Find.ClearFormatting

With Selection.Find
.Forward = True
.ClearFormatting
.MatchWholeWord = True
.MatchCase = False
.Wrap = wdFindContinue
.Execute FindText:=strNet
End With

If Selection.Find.Execute = True Then
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Cut
Windows("Temp.doc").Activate
Selection.PasteAndFormat (wdPasteDefault)
Else
Exit Do
End If

X = X + 1
Loop Until X = 500
Trying to Find each instance of the variable strNet. When all instances are found and cut over to the other doc then I want the loop to exit. I thought the If Selection.Find.Execute = True Then line worked initially but now seems to never get set to True. So maybe that won't work that way. So I put in the integer X to bail me out, which does work but is very sloppy. Thanks!

Selection Sorting
I have a selection made in a macro (consisting of two columns of data). I need to be able to sort the selection based on the second column (no matter where the selection actually lies. I have used this:

Selection.sort Key1:=Range(???), Order1:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

The question marks are what I do not know to put in. I need to be able to use this macro for wherever the selection is so I can't put in an absolute cell range.

Any ideas???

Picture Selection
I have a userform with a button that allows the user to browse for a picture. After locating the picture to be inserted, is there a way to have the path to the picture display in a textbox on the userform so that the user knows what picture he has chosen before it is inserted?

Search Selection
I have a document with a graphic on it. I want to be able to stop users from copying and pasting the graphic. I know there is not way to stop it completely, but I at least want to grop the hint. I want to be able to search the selection for the "group" that makes up the shape and remove that group from the selection. Any ideas?

Listbox Selection
Can somebody help me please??

I have a form with 20 small list boxes. How do i select a specific listbox
to add an item.
let say n is a variable between 1 and 20

listbox(n).additem(cells n,3) is what i have tryed and does not work

Thanks in advance

Selection Width
Dear All,


I don't know if I'm missing anything really basic here, but does anyone know how to translate the width of a line of text (in a given font) to points? (Obviously it may be more problematic than I believe, due to the setting of tabs etc, but anything might be useful).

If anyone knows I'd be greatful.


Regards,
Paul.

Vba Printer Selection
hi,
like my subject title already says ive a problem with the printer selection

im working in an office with a small network and different printers which can be used on the single computers

but the document i want to print have to be printed on a special printer
the problem i have is that the printer is installed on a different "position" on each computer
(i.e. on some computers it is the first, on others its the fourth)

so i thought this code can help me but it doesnt now nothing is printed anyway


Code:
If Application.ActivePrinter = "\VECTRA07HPLJ2200 auf Ne01:" = True Then
Application.ActivePrinter = "\VECTRA07HPLJ2200 auf Ne01:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
Collate:=True
End If
On Error Resume Next
If Application.ActivePrinter = "\VECTRA07HPLJ2200 auf Ne02:" = True Then
Application.ActivePrinter = "\VECTRA07HPLJ2200 auf Ne02:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
Collate:=True
End If
On Error Resume Next

...

If Application.ActivePrinter = "\VECTRA07HPLJ2200 auf Ne06:" = True Then
Application.ActivePrinter = "\VECTRA07HPLJ2200 auf Ne06:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, _
Collate:=True
End If
On Error Resume Next
End Sub

can anybody help me what did i make wrong
i thought its a good idea to let the prog look on which place the printer is installed and than let it print but it doesnt work
please help me

Selection List - Please Help!
A while ago I posted this cry for help:

"Hi everyone. I am very new to the world of VBA. Just made a working macro for a standard letter. I want to include a language selection (English, Dutch, German, French, Spanish) for standard text such as 'date' and 'subject'. I am thinking about a drop-down list or a list with selection possibility. How do I make something like that?

Thanks for suggestions!

Theoo"

So far, several people have read it, but no reply yet.

Does nobody have any suggestions for me? Please help!

Thanks!
Theoo

Selection List
Hi everyone. I am very new to the world of VBA. Just made a working macro for a standard letter. I want to include a language selection (English, Dutch, German, French, Spanish) for standard text such as 'date' and 'subject'. I am thinking about a drop-down list or a list with selection possibility. How do I make something like that?

Thanks for suggestions!

Theoo

Selection From Multicriteria
Dim Pressure Tube Descripiton PN
3/8 209 316 L ASTM A 269 WT 0,065 (1,65mm) 200001329
3/8 690 Duplex UNS S31803 A789 SMLS (1,8mm) 200007199
3/8 690 Super Duplex SS ASTM A 789 UNS S 32750
3/8 1035 Super Duplex SS ASTM A 789 UNS S 32750
1/2 209 316 L ASTM A 269 WT 0,065 (1,65mm) 200001330
1/2 1035 Super Duplex SS ASTM A 789 UNS S 32750
5/8 690 Super Duplex SS ASTM A 789 UNS S 32750 200017402
3/4 690 Super Duplex SS ASTM A 789 UNS S 32750 200017343

I have a form containg comboboxes, listboxes eg.
In comobox cboTubing1 I'm supposed to select a tube from which are
qualified based on preselcted values (Dim) cboLineDim and (Pressure) cboLinePressure.

Example. I have 3/8 tube and pressure less than 690, I should than have 3 tubes to choose between,
but my code does'nt give me the right selection in combobox cboTubing1.


Code:
Private Sub cboTubing1_DropButtonClick()
cboTubing1.RowSource = ""
Sheets("Tubing").Activate

Range("F3:G11").ClearContents 'Clearing contents in temp storing cells

Dim Antall_Rader As Integer
Dim Rad As Integer
Dim NewRow As Integer
Antall_Rader = 10 'Number of rows that contain part information
Rad = 2
NewRow = 3

For I = 1 To Antall_Rader
If Cells(Rad, 1).Text = cboLineDim.Text And Cells(Rad, 2).Text <= cboLinePressure.Text Then

Cells(NewRow, 6) = Cells(Rad, 3)
Cells(NewRow, 7) = Cells(Rad, 4)
NewRow = NewRow + 1
End If
Rad = Rad + 1
Next I

cboTubing1.RowSource = "F3:G" & NewRow

End Sub


Additional function is that corresponding PN number has to follow the selected value (tube).


Can someone give me a hint here?

How To Exit Sub If No Selection
Hi all, (newbie)

I have managed to cobble together some code to insert pictures and resize to a specific size.

But the code breaks if I "cancel" at the insertpicture dialogue box.

(It is ok if I continue and select a picture).

How do I exit sub on deciding to leave without a selection




Sub InsPicture()


Application.Dialogs(wdDialogInsertPicture).Show
""HERE IS THE PROBLEM - SOMETHING LIKE""
'if selection = "" then exit sub

Selection.Find.ClearFormatting
With Selection.Find
.Text = "^g"
.Forward = False
End With
Selection.Find.Execute etc etc

tia kd

Help With Range Selection?
Hey,

I am working on getting a range selected by the user by the way of userform. Mill, thanks for the help with the combobox. You are right however, the dates do not match. I hav decided to go with the ListBoxes. I am running into a problem however. I followed an example by Mill and tried to convert it to my needs. I am trying to find the start (Listbox1) and ending (listbox2) date on the second sheet of my workbook, and then select the rows between them(including them). I have everything already setup, I just cannot seem to search for them and do the selection.

Any ideas where I am going wrong?




Code:
Dim intFirstRow As Integer
Dim intLastRow As Integer
Dim strRow As Date
Dim endRow As Date


If ListBox1.Value = "" Then
MsgBox ("You must enter a start date.")
Else
If ListBox2.Value = "" Then
MsgBox ("You must enter an ending date.")
Else
If ListBox2.Value < ListBox1.Value Then
MsgBox ("The start date must be less than the ending date.")
ListBox1.Value = ""
ListBox2.Value = ""
Else

strRow = ListBox1.Value
endRow = ListBox2.Value
Sheets(2).Select
Range("Date_Range").Select

intFirstRow = Selection.Find(What:=strRow, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate

intLastRow = Selection.Find(What:=endRow, After:=ActiveCell, LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Activate
Range("strRow, endRow").Select



End If
End If
End If
Thanks,
Mike

Easy Selection
What would be the syntax to select a Level 1 heading style in the active Word document?

Object Selection
Ok, Im trying to make a small level editor with d3d8...I dont want to make it so you HAVE to use orthographic views of the level to change it, but to be able to edit in a perspective view...

I assume I would cast a ray out from the mouse position, and see what it hits...is this correct?
Does anyone have any information on doing this? I have no idea....



Later,
rkinasz

Shape.selection
Hi ALL,

I have question about selection of specific shapes or textfields. I want them selected only if their text equals to "S"... in selected range of cells - is this possible somehow?

Looking forward for some reply

Thanks a lot.
Dingo123

Range Selection
Hi all!

can someone help me?
I am trying to create a code to automate a file extraction process in VB using excel object. what i need is for the system to find specific cell & then copy all the related data into a template file.

theres an attacment to visualise the data I need to extract. for this example I want to extract the range containing LHead along with its X,Y,Z content (position data).

a little help please ....

Selective Selection?
I have one file in objFileList containing in it's name the word "Package". Is there any way I can remove it from objFileList?


Code:
For Each file In objFileList

fullpath = folderpath & "" & file.Name

Sheets("Money Chart").Select

Range(Cells(i, j), Cells(i, j)).Value = fullpath

i = i + 1
Next

Copyright © 2005-08 www.BigResource.com, All rights reserved