excel-2010

When a cell value changes, copy the column from where the cell value changed to another sheet at the same range

百般思念 提交于 2019-12-13 05:06:25
问题 For example, if in the range of A:A only cell A8 change then copy D4:D8 and paste it as value in sheet "ADP" at the same place i.e. D4:D8. For that I have tried the following macro Private Sub Worksheet_Change(ByVal Target As Range) If Target.range = "A:A" Then Call copy_paste_as_value End If End Sub Sub copy_paste_as_value() Range("d4").Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Sheets("ADP").Activate Range("B4").Select Selection.PasteSpecial Paste:=xlPasteValues,

trying to expand vlookup to other cells without automatically changing values

流过昼夜 提交于 2019-12-13 05:05:24
问题 I am setting up a vlookup to pull product prices from another sheet within the workbook. The code works for the cell but when i try to expand or copy and past the code into the next row it automatically changes the data table_array value. =VLOOKUP(B5,Prices!1:65536,3) Within the code i want the first value, B5 to scale with the row it is in, however the second value needs to remain the same. How do i go about doing this? Also is there a way that i can get the cell to remain blank instead of

How to execute Open and Close function on multiple text files? [closed]

佐手、 提交于 2019-12-13 04:39:56
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am trying below code but for some reason, it is not workning as the logic suggest. myTxt = Application.GetOpenFilename("Text Files,*.txt", , , , True) On Error Resume Next filecount = UBound(myTxt) On Error GoTo 0 If filecount = 0 Then MsgBox "No text file selected. Exiting now.", _ vbExclamation: Exit Sub For

MS Excel - replicating a series of cells [closed]

痞子三分冷 提交于 2019-12-13 04:39:00
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have the following data in a spreadsheet: I I need a formula/workaround that would give me the following: Thanks, 回答1: You can reference and repeat data by using the INDEX function. Placing the formula =INDEX(A:A,FLOOR((ROW()+4)/5,1),1) into a cell on the first row ( B1 , C1 , etc.) and copying down will

Excel: Replace strings with numbers in a formula?

荒凉一梦 提交于 2019-12-13 04:18:36
问题 I have color strings in one of my columns, like red, purple and so on. I want to replace those colors with corresponding numbers. Red becomes 1, purple becomes 2 and so on. Thats not so hard, I used substitute, like this: SUBSTITUTE(E3;"red";"1") Now the problem ist that some columns have 2 or more colors, like "red purple", so I tried using: SUBSTITUTE(E3;"red";"1")&SUBSTITUTE(E3;"purple";"2") That results in a value in my column that looks like 1red, There is the color from that row

Recordset field values return null from SQL server with varchar(MAX) data type

一世执手 提交于 2019-12-13 04:07:24
问题 I have an SQL 2008 server, in the server is a table that has a column with a data type of varchar(MAX). I am trying to import certain columns from this table into Excel 2010 using ADO. Here is an example of the code I am using: Dim con As Object Set con = CreateObject("ADODB.Connection") cmd.CommandText = "SELECT dbo.(Table Name).Name From dbo.(Table)" cmd.CommandType = 1 con.open cmd.ActiveConnection = con Dim rst as Object set rst = cmd.Execute ActiveSheet.cells(targetRange.Row, targetRange

Can you use Cells instead of Range inside of an Autofill function?

断了今生、忘了曾经 提交于 2019-12-13 03:44:27
问题 If I have this, for example: Sub ExampleThing() Counter = 13 For i = 1 To Counter Range("A" & i) = Rnd Next Range("B1").Formula = "=(PI()*A1)" Range("B1").Select Selection.AutoFill Destination:=Range("B1:B" & Counter), Type:=xlFillDefault End Sub What if, instead of using Range() under Destination, I wanted to use Cells()? Like, instead of having cell references inside the range function, replace that with Cells(), like this: Selection.AutoFill Destination:=Range("Cells(1,2):Cells(Counter,2)"

If IsInArray(Cells(r, 2), Break_List) = True Then Excel VBA

纵然是瞬间 提交于 2019-12-13 03:33:26
问题 I have been following this question quite deeply and trying to match Cell(r,2) on one sheet to an array I compiled below cycling through rows in column 2 on another sheet but I keep getting a False value returned from the function. Public Break_List(1 To 1000, 1 To 100) As Variant If IsInArray(Cells(r, 2), Break_List) = True Then Sub Store_Break_Categories() Sheets("BackEnd").Select Break_No_of_Rows = 0 'For c = 10 To 15 counter = 0 If Cells(2, 3) <> "" Then lastrow = Cells(65000, 3).End(xlUp

Excel: Searching for multiple terms in a cell and return the found value

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 03:31:56
问题 I am trying to scan a column and search for terms inside a cell. Once any of these terms are found, place the found one in another cell. The terms are in a named range, I call it "namedrangeOfApps" with over 400 rows. This is what I have now but instead of returning TRUE I want to return the actual value found. =SUMPRODUCT(--ISNUMBER(SEARCH({"namedrangeOfApps"},G2)))>0 Example of a cell could be: "Microsoft.Office.v.21" In this case, if either Microsoft and or Office is found" Place the found

Excel - Match, Lookup or Index

女生的网名这么多〃 提交于 2019-12-13 03:08:13
问题 am sure this is an easy question but getting confused between all the formulas- Lookup , Match , Index etc. I have 2 sheets - SOW Actuals and RAW Project data . In column N of SOW Actuals I have the values I am trying to find in cells A2:A60 of Raw Project data . When the formula finds a value I want it to return the value from column G on the same row in Raw Project data . 回答1: INDEX and MATCH are more efficient and flexible than VLOOKUP . In your case, try: =INDEX('RAW Project Data'!$G$2:$G