Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-28-2012, 04:30 AM
gsrikanth gsrikanth is offline changing Windows XP changing Office XP
Competent Performer
changing
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default changing

change to macro

Code:
Sub Test()
Dim rngToChange As Range
Dim iMultiplier As String
Dim iDivisor As String
With Sheets("Sheet1")
  iMultiplier = .Range("A1").Value
  iDivisor = .Range("A2").Value
  .Range("A3").Value = iMultiplier & iDivisor
  Set rngToChange = .Range("B1:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
  .Range("A3").Copy
  rngToChange.PasteSpecial _
  Paste:=xlAll, Operation:=xlMultiply, SkipBlanks:=False, Transpose:=False
  Application.CutCopyMode = False
End With
End Sub




convert to application.inputbox

Last edited by macropod; 02-06-2012 at 07:36 PM. Reason: Added code tags
Reply With Quote
  #2  
Old 02-06-2012, 07:41 PM
macropod's Avatar
macropod macropod is offline changing Windows 7 64bit changing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi gsrikanth,

Other than apparently wanting to concatenate the data from two ranges, it's not at all clear what you want the input boxes for.

Also, when posting code, please use code tags.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 02-06-2012, 11:57 PM
gsrikanth gsrikanth is offline changing Windows XP changing Office XP
Competent Performer
changing
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi gsrikanth,

Other than apparently wanting to concatenate the data from two ranges, it's not at all clear what you want the input boxes for.

Also, when posting code, please use code tags.
plz find the attachment in sheet 1 two columns data
in sheet to i calculate second columns data by keeping forumula =1/2 that value should add to first column
any alternative data is adjucent only it should add

like add comment i need add cell by crtl+j macro
Attached Files
File Type: xlsx Book12.xlsx (126.6 KB, 8 views)
Reply With Quote
  #4  
Old 02-07-2012, 04:30 AM
macropod's Avatar
macropod macropod is offline changing Windows 7 64bit changing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I've look at your workbook. It's nothing like the image attached in your first post and there is still nothing to indicate what any input boxes might be used for.

Perhaps you want code like the following:
Code:
Sub CombineValues()
Dim i As Long
With ActiveSheet
  For i = 1 To .Range("B" & .Cells.SpecialCells(xlCellTypeLastCell).Row).End(xlUp).Row
      .Range("B" & i).Value = .Range("A" & i).Value + Evaluate(.Range("B" & i).Value)
      .Range("B" & i).NumberFormat = "General"
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 02-07-2012, 04:48 AM
gsrikanth gsrikanth is offline changing Windows XP changing Office XP
Competent Performer
changing
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
I've look at your workbook. It's nothing like the image attached in your first post and there is still nothing to indicate what any input boxes might be used for.

Perhaps you want code like the following:
Code:
Sub CombineValues()
Dim i As Long
With ActiveSheet
  For i = 1 To .Range("B" & .Cells.SpecialCells(xlCellTypeLastCell).Row).End(xlUp).Row
      .Range("B" & i).Value = .Range("A" & i).Value + Evaluate(.Range("B" & i).Value)
      .Range("B" & i).NumberFormat = "General"
  Next
End With
End Sub
if there is text means
change this Evaluate(.Range("B" & i).Value)

Reply With Quote
  #6  
Old 02-07-2012, 02:37 PM
macropod's Avatar
macropod macropod is offline changing Windows 7 64bit changing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi gsrikanth,

Try:
Code:
Sub CombineValues()
Dim i As Long
With ActiveSheet
  For i = 1 To .Cells.SpecialCells(xlCellTypeLastCell).Row
    If IsNumeric(Evaluate(.Range("A" & i).Value)) And IsNumeric(Evaluate(.Range("B" & i).Value)) Then
      .Range("B" & i).Value = Evaluate(.Range("A" & i).Value) + Evaluate(.Range("B" & i).Value)
    Else
      .Range("B" & i).Value = .Range("A" & i).Value & " " & .Range("B" & i).Value
    End If
      .Range("B" & i).NumberFormat = "General"
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 02-08-2012, 04:58 AM
gsrikanth gsrikanth is offline changing Windows XP changing Office XP
Competent Performer
changing
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default

i have to convert in different cells like a3,b23,c1,d50.
i need is, if i click in a3 adjecent of a3, i.e.,a2 come in a3
click or macro
Reply With Quote
  #8  
Old 02-08-2012, 02:42 PM
macropod's Avatar
macropod macropod is offline changing Windows 7 64bit changing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi gsrikanth,

It is difficult to know what you want, because you don't explain it very well and I have to guess what you mean. Try the following but, if it's not what you want, I'm not going to spend any more time on it unless you give a clear explanation.
Code:
Sub CombineValues()
Dim StrTgt As String, i As Long, j As Long
With ActiveCell
  StrTgt = UCase(Left(Trim(InputBox("Combine with cell:" & vbCr & _
    "(A)bove" & vbCr & "(B)elow" & vbCr & _
    "(L)eft" & vbCr & "(R)ight", "Get Source Direction")), 1))
  If StrTgt = "" Then Exit Sub
  Select Case StrTgt
    Case "A": i = -1: j = 0
    Case "B": i = 1: j = 0
    Case "L": i = 0: j = -1
    Case "R": i = 0: j = 1
    Case Else: Exit Sub
  End Select
  If .Column + i >= 0 And .Row + j >= 0 Then
    If IsNumeric(Evaluate(.Offset(i, j).Value)) And IsNumeric(Evaluate(.Value)) Then
      .Value = Evaluate(.Offset(i, j).Value) + Evaluate(.Value)
    Else
      .Value = .Offset(i, j).Value & " " & .Value
    End If
      .NumberFormat = "General"
  End If
End With
End Sub
With this code, simply select a cell and run the macro. It will ask whether you want to combine the cell's contents with those of the cell above, below, left or right.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 02-08-2012, 09:09 PM
gsrikanth gsrikanth is offline changing Windows XP changing Office XP
Competent Performer
changing
 
Join Date: Dec 2011
Posts: 133
gsrikanth is on a distinguished road
Default

Great! Goal.......! thanks for patients you look on me, solved
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing Changing accounts on same PC cjansley Outlook 1 07-27-2011 07:36 AM
changing Changing the From field jerem Outlook 2 10-29-2010 03:04 PM
Changing list of Value xmadnet Word 0 09-07-2010 01:48 PM
Changing Word doc to .txt cialili Word 1 08-02-2010 12:38 PM
changing font size without changing leading carolns Word 1 09-14-2009 12:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft