Losing ActiveCell Value
May 30, 2006
I have a list of line entries for which I need to insert a variable amount of empty lines per line. (the variable amounts listed in a column to the right of my Active Row.
Unfortunatly I loose the ActiveCell's Value. During Debug it shows the correct cell and value, but after the Debug Step Over, the value shows 0 again. I include my
[code]
Sub IP_Insert_rows()
'
' IP_Insert_rows Macro
' Macro recorded 2006/05/29 by Joseph Clark
'
Dim GrpCtrVar As Integer
Dim LnCtrVar As Integer
GrpCtrVar = 3
LnCtrVar = Range("B8").Value
View 4 Replies
ADVERTISEMENT
Apr 6, 2007
Does this code copy all cells from the active cell up to the last non-blank cell, or is it up to the first blank cell after the last non-blank cell?
View 9 Replies
View Related
Aug 17, 2009
i have the following code for sending a worksheet to a closed workbook
View 14 Replies
View Related
May 5, 2006
In the attached file (I'm sorry it is zipped, it was just too big), I gave you a snippet of my database. The actual one has 9000+ records. Over in Y4, you'll see the Sum of all the amounts (column X). Run the first macro, that is, Copy Dups, and you'll see it splits the item up by the numbers in column N. This works perfectly (or so it appears.) Then, run the Summary macro (the only other macro in there) and you will see that it pulls the Sums of each spreadsheet and places them on one nice overview page. The summary page. The only problem is, the total of the subtotals on the summary page do not match the total on the main (unadultered) page. I hope i am explaining this right. Somewhere in the macros, I am losing data from my spreadsheets so that the summary page is not equal to the un-macro'd data.
/scratches head
View 9 Replies
View Related
Jul 28, 2006
As you can see this macro copies a worksheet from one workbook to a new one. It is 14 columns wide by just under 700 rows long. I am losing information out of cells all over the place.
ChDir "H:HOMETIMCEXCELCOUPON_COUNT6_JUN"
Workbooks.Open Filename:="H:HOMETIMCEXCELCOUPON_COUNT6_JUNJUN_2006" + ".xls"
Calculate
Sheets("MONTH_END").Select
Sheets("MONTH_END").Copy
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False .........................
View 2 Replies
View Related
Jan 6, 2014
In cell L7 I have (80/60)/24 and formatted h:mm to get 1:20. In cell M11 I have 1:00 (h:mm). In cell M12 I have L7-M11 and get the result 0:19. Why I'm losing a minute and not getting the result 0:20?
View 5 Replies
View Related
Nov 14, 2008
I've got two columns:
A, B
abc, def
qwe, rty
asd, fgh
zxc, vbn
And I need to bring these together in one column so it looks like this
C
abcdef
qwerty
asdfgh
zxcvbn
View 2 Replies
View Related
Oct 20, 2008
I've got a function called countcolor (which I take no credit for) which counts a particular color in a range.
---------------------------------------------------------------------
Function CountColor(rColor As Range, rSumRange As Range)
Dim rCell As Range
Dim iCol As Integer
Dim vResult
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = vResult + 1
End If
Next rCell
CountColor = vResult
End Function
I have then set up a couple of macros which, when ran, fills a range of cells with a particular color. These colors are closely related but as you can see from the two macros below they ARE different. I'm finding my countcolor function is counting them twice though even though as you can see the color values are different.....
---------------------------------------------------------------------------
Sub pegcharged()
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 25600...........................
View 9 Replies
View Related
Mar 31, 2009
I need to make an excel sheet with checkboxes (around 50) which each add a value to 1 cell when clicked.
If you click them again the value should be removed again from the cell.
So lets say I got cell A2 and I got checkbox 1 to 5. Checkbox 1 has value 1 checkbox 2 value 2 etc. up to 5.
So if I click Checkbox 1 and 4, cell A2 should display "5". If I check Checkbox 1 off it should display "4". Now I tried to do this but I really cannot get cell A2 to display "4" again (clicking Checkboxes again just adds another value).
I know why this is the case, I defined checking the checkbox as click, not as "check" but I have no idea how to do this correctly.
Little info:
I have little to no experience in VB but got some programming experience next to it. I am using Excel 2007 (forced to, work).
View 9 Replies
View Related
Jun 8, 2006
I have an application where by the user only sees userforms which then writes the data to the back end worksheets. So the Menu or front useform I have set at vbModeless, which also means that the user can now open up or use an already opened spreadsheet. I believe I am correct in saying you can't do this if the userform is modal. Anyway this is what the user wants, i.e to be able work on multiple spreadsheets, whilst my app is open. The problem is when they click on one of the other open spreadsheets and then click one of the buttons on my application, you get an error.
I believe is because I use code such as
frmMetrics.Show
Where I haven't specified the actual workbook, so excel doesn't know where to go to find the userform. So how do I specify the workbook, without constantly having to change the line, when version numbers changes ?
eg
Application.workbooks("Book1")
For the next revision the file may be called Book1.1
Application.workbooks("Book1.1")
View 2 Replies
View Related
May 22, 2007
This is probably a simple one but I can't figure it out. I am building a workbook from scratch. It has about twelve of thirteen tabs at the bottom. On one of the tabs I would like to copy and paste a stand alone worksheet. The worksheet functions properly when it is stand alone. However when I copy and paste the worksheet into this new workbook none of the formulas transfer with it. I do get the cells filled in, but I would like to get the formulas.
I have done this before and it worked fine. In fact I can open a new workbook and copy / paste the worksheet into it and everything works fine. Again when I copy / paste it to this new workbook the formulas do not transfer.
View 4 Replies
View Related
Jan 29, 2009
I have an Excel 07 spreadsheet containing multiple tabs, modules, and userforms.
In Module1, I have a public variable declared as boolean - will call it X. When X is selected from a combo box in Userform 1, X is set to TRUE. However I've noticed that when the user enters Userform 2, X is somehow set to FALSE.
I can't set it back to TRUE at that point because more often than not, it SHOULD be FALSE, thereby sending the macro down a different path. Any idea how I can retain the "TRUE" value for X. I've tried changing the Public Variables to Global, but am still having the problem.
View 2 Replies
View Related
Jun 27, 2014
I am trying a macro to merge cell without losing the data until I find a next cell with the data - This merging should be pertain only for the column selected. Is it possible to write a macro and preform this activity.
View 1 Replies
View Related
Jan 14, 2013
Is there a way to prevent formulae from losing their references when the references get replaced.
I have formula which refer to a worksheet that is dynamic, meaning that the worksheet holding the data (CONTROL_1) differs from one query to the next is imported from another source. The datasource contents and format are identical.
View 6 Replies
View Related
Oct 30, 2013
My data is in column A , Column B and Column C, where are column C has a uniuqe value for certain rows.
Based on these uniques value, column A and Column B should be merged to singe Row without loosing data.
MY Data:
Source address
Destination address
Destination Port
Application
IP Protocol
192.168.1.2
192.168.250.10
53
dns
udp
[Code] .......
Result expecting is :
Source address
Destination address
Destination Port
Application
IP Protocol
[Code] .......
View 7 Replies
View Related
Dec 4, 2013
I have a data set that I'm trying to sort in order to be efficient for some of my team members.
Below is an example of the raw data and how I've currently got it sorted. I think my problem may be that I am trying to join a number with a string but I'm not positive.
Col A
123-45678-A-1
123-45678-A-10
123-45678-B-2
I need to eliminate the letter from the data, add a leading zero to all single digit numbers and sort ascendingly.
My first step is to split the data into columns using the "-" as a delimiter. I end up with 2 columns as shown below.
Col A
Col B
123-45678-
1
123-45678-
10
123-45678-
2
Next I add a leading zero to Col B. The assumption is there will never be more than 99 numbers, so I use the following code:
Columns("B:B").Select
Selection.NumberFormat = "00"
To produce:
Col A
Col B
123-45678-
01
123-45678-
10
123-45678-
02
Now all I need to do is rejoin these 2 columns before sorting. My current code is:
Sub Rejoin_Container_Number()
x = 1
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Do While Cells(x, 2).Value ""
Cells(x, 1).Value = Cells(x, 2).Value & Cells(x, 3).Value
[Code]...
As many have probably already guessed, this produces the following result:
Col A
123-45678-1
123-45678-10
123-45678-2
I'm looking for:
Col A
123-45678-01
123-45678-10
123-45678-02
**zeroes in BOLD for reference only, result does not need to be bold**
View 4 Replies
View Related
May 8, 2009
Whenever a particular file is saved, and then reopened it says "Error Data Lost" and the entire column that used to have the formulas now has =#NA.
Its only happening in 1 particular column. Anyone know a specific reason this might happen or is something in my code just jacked up?
View 9 Replies
View Related
Aug 22, 2008
I have the same problem as Paul C in the following post:
(Pictures disappearing)
"Hi not a VBA problem, but when i insert pictures or logos into my workbook they disappear, i can insert a picture close the workbook but when i re-open it the picture has gone, i have to click on where it should be to get the border to appear, the move it to get it to appear.
I have tried inserting BPMS, JPGS, GIFS, but i have the same problem with them all, I have used the bring forward command but still have the same problem, I have even tried re-installing Office 2003 and installing all the latest updates but still get the same problem, any ideas?"
I have tried:
- Tools > Options > View > Objects > Show All
- Changing macro security level
- disabling macro security in my antivirus
View 9 Replies
View Related
Jan 4, 2007
I'm using a VBA UserForm (ShowModal=False) as the front-end on a spreadsheet for logging purposes. Here's the progression of the problem:
1. I have the UserForm loaded and the cursor is in any given textbox/ combobox on the form.
2. I switch to another program, then come back to the UserForm.
3. The cursor no longer appears in whatever textbox/combobox I was in when I left the UserForm. If I type, nothing happens (I have to click the field again first, then type).
However, if I TAB, it will go to the next field in the Tab Order just fine. It seems that the control has "pseudo-focus"--it knows which field to tab to next, but the control won't accept input unless you click it. The odd thing is--this UserForm has a button which launches another "child" UserForm. That "child" UserForm does not have this problem.
View 3 Replies
View Related
Jun 27, 2014
How to make a formula with references to certain cells, so I can sort the sheet but keep the formula referring to the same cells as before the sorting?
In the example I illustrated the problem: when I sort the data, the formula refers to the same cells which have now different values, so the calculation is not right anymore.
View 1 Replies
View Related
Jul 3, 2013
sample merging file.xlsx
I have a data array of 7 col and 256 rows. I want to focus only on the first 2 columns though. Here is what is going on. In the first column I have numbers from 1-256, these numbers are merged to the appropriate size to accommodate the data in column 2. However, the data in column 2 is not merged, it consists of 1,2, or 3 lines of text. Excel deletes the text in the rows below 1 if I try to merge, excel does not allow multiple row merge selections. What I am looking for is a formula that looks at column 1, finds how many rows are being merged in column 1, then looks at column 2 and identifies the number of rows needed for merging and displays that text in only one row. Basically, it's a formula that merges multiple rows of text in col 2 depending on the number of merged rows in col 1.
No.Customer/Operator
1Fairbanks Morse /
Beloit, WI
2H+H Umwelttechnik /
[Code]....
View 1 Replies
View Related
Sep 24, 2013
This refers to Excel 2003. I will be dragging contents of cells to another place on the same worksheet. To make myself clear, the text must be moved from the source cells to the destination cells, leaving the format of both source and destination cells - such as borders and fill - unchanged.
NOTE: I know that I can copy the cells and return to the destination cells to delete the content that I want to move. This wastes time when doing many drags and drops.
NOTE: I know that I can paste special, pasting the Values only. Again, this is a lot of extra clicking or keyboard shortcuts. Again this wastes time when dragging and dropping many times.
View 2 Replies
View Related
Aug 3, 2012
I have 4 different workbooks that I want to merge into one workbook. I tried moving the sheets from these workbooks into one workbook but to my surprise all the vba / macros didn't transfer over to the other workbook.
I searched here but all I can find were people that wanted to make a summary workbook or merge workbooks into a worksheet which isn't what i want to do.
I just want to simply merge these workbooks into one workbook without losing all the marco and vba stuff that are in each workbook.
View 2 Replies
View Related
Dec 6, 2006
Is there a way to clear the contents of each cell in a range without losing formulas?
View 9 Replies
View Related
Mar 9, 2007
Passing an array from a sub to another sometimes works, sometimes not. But when I call the same sub twice, it definately gets stuck at least at the second time. Seems as if I tend to lose some of my items of the array. And I cannot figure out why it happens, at what pace it happens or how I could stop this from happening.
1.Could it be that a control perishes as soon as it is set to 'ctrl.enabled=false'? 2.Or could it be that a declared array 'ary=array(tb1,cb1,frm1)' can not be handled without having had its items initialized with some lines of code, although the items visibly exist within the user form? 3. Can it be that a Sub 'remembers' the former values passed to it, if set to 'optional'?
However, I have added a cleared/minimized version of my userform as a file to this post, hoping that some of you out there might find the time to have a look at it.... I would really appreciate it. I have added the decisive parts of the macro below here, as well,
Private Sub UserForm_Initialize()
Dim elem As Variant
Dim wSht As Worksheet
Dim ctrl As Control
'set control arrays
'[...]
ctrlAllStep2 = Array(cbTimeOnly, cbIntensityOnly, cbAreaOnly) '[...]
ctrlAllStep3 = Array(tbIntensityTotal, tbIntensityBleached) '[...]
MsgBox "Two Controls exist now: 1." & ctrlAllStep2(0). name & ", 2. " & ctrlAllStep2(1).name, vbInformation, "Note: controls exist..."
'disable Controls in Step2 and in Step3....................
View 5 Replies
View Related
Dec 18, 2006
Here's the situation:
I want to search through the cells in a column to locate text in one of the cells. If this text is found, I want to make that the ActiveCell and then insert a row underneath it. If this particular text is not found, I want to insert a row and put that text that wasnt found into the first cell in the created row.
I trimmed down my code a lot so I could post it here.
So, in this particular case, once the user selects one of two product lines (named "ADC" and "DAC"), I want to first search for that text and if it is found I want that to be the new activecell and insert a new row.
The main problem is that I can't seem to figure out how to set the "Foundcell" as being the new active cell. My initial activecell is set by locating and selecting the cell containing the text "Product Line".
Here's my
View 10 Replies
View Related
Jun 5, 2013
Collapsing function: I want to select cells that I want merged, and have them COLLAPSE into the first cell selected calls
Combining function: OR Select the cells I want merged, and allow me to pick a destination cell for the result COMBINE
I would like to add this functionality to all my spreadsheets in the future.
Excel-Forum-Data Collapsing sample.xls
View 1 Replies
View Related
Aug 31, 2009
Trying to create a macro that will add the date & time & initials (i.e 8/26/09 2:34 PM JOD) into the current cell.
I've found plenty of macro's that will do this but it ends up deleting any existing text within the cell. I need to be able to add it in the middle of a text string.
View 10 Replies
View Related
Aug 7, 2009
How can I select the current activecell and the next 50 following rows of that column? I cannot define a range since it has to variable.
View 4 Replies
View Related
Nov 23, 2009
ActiveCell.Activate. I'm reading through a VBA book and one line of code was
View 4 Replies
View Related